Could someone help me understand the use of beanInterface parameter of @EJB annotation in JavaEE 6?
I have a situation in which I have an EJB and I want it to be accessed locally and remotely as well.
I have a MyBaseInterface and then both MyEJBLocalInterface and MyEJBRemoteInterface extending MyBaseInterface. Now I have MyEJB which is implementing both MyEJBLocalInterface and MyEJBRemoteInterface.
Now I have a situation in which I want only to access MyEJB locally.
Could I achieve the same with the following?
@EJB(beanInterface=MyEJBLocalInterface.class)
private MyBaseInterface instanceOfLocallyAccessedMyEJB;
Could someone help me understand the use of beanInterface parameter of @EJB attribute?
Thanks.
the beanInterface attribute of the @EJB annotation is used for different purposes depending on the EJB version you are using:
To sum up, yes. You should be able to use it to inject the desired interface.
This might not be supported in older versions of JBoss though.