[英]When I use dependecy injection like @Inject in my entity class it throw an error
@Stateless
public class MyAccountsBean {
@Inject SomeEntityClass someOtherBean;
@Resource UserTransaction jtaTx;
@PersistenceContext(unitName="AccountsPU") EntityManager em;
@Resource QueueConnectionFactory accountsJMSfactory;
@Resource Queue accountPaymentDestinationQueue;
public List<Account> processAccounts(DepartmentId id) {
// Use all of above instance variables with no additional setup.
// They automatically partake in a (server coordinated) JTA transaction
}
}
There are likely multiple issues, but one that sticks out is that all of the fields should be marked with the private
modifier.可能存在多个问题,但突出的一个问题是所有字段都应使用private
修饰符进行标记。
In addition, can you post the rest of your codebase and the error you are getting?此外,您能否发布其余的代码库以及您遇到的错误?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.