I am working in a JavaEE
Project and i use an interface to implement method but when i want to use an EJB
it say that my EJB is null
Interface.java
public interface Interface { public void methodTest (); }
SubInterface.java
public class SubInterface implements Interface {
@EJB
private myEJB myejb
@Override
public void methodTest(){
if( myejb == null ){
System.out.println("He is null");
}
}
}
myEJB.java
@Stateless
public class myEJB extends SomeAbstractFacade {
@PersistanceContext
private EntityManager em ;
....
}
UserController.java
@ManagedBean
@ViewScoped
public class UserController extends SomeAbstractController implements Seializable{
private interface myInterface ;
public void method (){
myInterface = new SubInterface();
myInterface.methodTest();
}
}
when i execute methodTest we can read in the output he is null.
thank you