EJB 3.1 @EJB注入POJO [英] EJB 3.1 @EJB Injection into POJO

查看:119
本文介绍了EJB 3.1 @EJB注入POJO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



使用新的EJB 3.1规范可以将一个EJB注入pojo吗?我知道在EJB 3.0中,@EJB注释可以用于注入EJB,但是这并不适用于简单的pojos。



如果不是我必须查看我知道你不能简单地使用新的关键字,JNDI中的bean。



提前感谢。



Karl

解决方案

是的,使用JNDI查找。 >

由于您的POJO是由您创建的(我假设),容器不负责注入依赖关系。


Being a complete turbot this afternoon and cant seem to find the answer anywhere.

With the new EJB 3.1 spec is it possible to inject an EJB into a pojo? I know in EJB 3.0 the @EJB annotation could be used to inject an EJB but this did not work on simple pojos.

If it is not do I have to look the bean up in JNDI as I know you cannot simple use the new keyword.

Thanks in advance.

Karl

解决方案

Yes, use JNDI lookup.

Since your POJO is created by you (I assume), the container is not responsible for injecting the dependencies.

这篇关于EJB 3.1 @EJB注入POJO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆