开发者

What happens if I remove the @EJB annotation?

I read the article on: 开发者_高级运维http://en.wikipedia.org/wiki/Enterprise_JavaBean

Just wondering: What will happen if I remove the @EJB annotation?


I guess you refer to the second exemple of code in this page.

If you remove the @EJB annotation, dependency injection isn't done anymore on this attribute.

In this case, it means that the reference to the CustomerServiceLocal EJB will never be injected in your current instance, and, in this case, any call to the addCustomer() method will throw a NullPointerException.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜