可以将无状态会话bean注入jsf托管bean吗?
我有
@ManagedBean(name = "imageUpload")
@RequestScoped
public class ImageUploadBean extends FileUploadBean {
@EJB
GenericEntityService genericEntityService;
...
}
public interface GenericEntityService {
<T> T getById(int id, Class<T> entityClass);
void deleteById(int id, Class entityClass);
}
@Stateless
public class GenericEntityServiceImpl
extends EntityServiceBase implements GenericEntityService
{
...
}
genericEntityService始终为null,我不知道为什么
我使用tomee-webprofile-1.5.2
任何帮助或链接到示例将不胜感激
答案 0 :(得分:0)
更新:这个答案很有用,因为默认情况下界面是@Local
AFAIR您可能需要在界面上指定本地或远程注释尝试它:
@Local
public interface GenericEntityService {
<T> T getById(int id, Class<T> entityClass);
void deleteById(int id, Class entityClass);
}