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
.
精彩评论