我在JBoss5.1.2 JDK6.1设置中有一个无状态EJB,将属性注入“资源”
@Resource(name="defaultPlayEstimateAdjustment")
Integer defaultPlayEstimateAdjustment;
<env-entry>
<env-entry-name>defaultPlayEstimateAdjustment</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>${xyz.ejb.pxp.defaultPlayEstimateAdjustment:10}</env-entry-value>
</env-entry>
xyz.ejb.pxp.defaultPlayEstimateAdjustment=200
属性值200未设置...并且它以“null”值进入?
但是,如果它使用完整的JNDI名称查找initialcontext,则值200即将出现!我是否缺少任何支持注释的依赖JEE jar?
final Integer defaultPlayEstimateAdjustment = (Integer) initialContext.lookup("java:comp/env/defaultPlayEstimateAdjustment");
有什么建议吗?
答案 0 :(得分:0)
添加以下排除项后... EJB postConstruct确实被调用,@ Resource源注入也有效。
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${resteasy.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<artifactId>jsr250-api</artifactId>
<groupId>javax.annotation</groupId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
</exclusions>