I have an EJB bean injected in a Managed Bean. Its constructor is called twice. For example, I get:
com.logic.jsf.AdditionManagedBean created
com.logic.Addition$$$view45 created
com.logic.Addition created
I know @PostConstruct but I'm trying to understand why that happens. Is it because of proxy, and in that case shouldn't I see a proxy related literal in the printed name of the class?
@Stateless
@LocalBean
public class Addition{
public Addition(){
System.out.println(this.getClass().getName() +" created");
}
public String getAddition(){
return "Addition";
}
}
Injected in:
@ManagedBean
@RequestScoped
public class AdditionManagedBean {
@EJB
Addition addition;
public AdditionManagedBean(){
System.out.println(this.getClass().getName()+" created");
}
public String getAddition(){
return addition.getAddition();
}
}