开发者

What happens if I remove the @EJB annotation?

开发者 https://www.devze.com 2023-03-06 10:10 出处:网络
I read the article on: 开发者_高级运维http://en.wikipedia.org/wiki/Enterprise_JavaBean Just wondering:

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

精彩评论

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

关注公众号