[jboss-user] [EJB 3.0] - Re: @EJB does not work in JSF backing bean constructor
jaikiran
do-not-reply at jboss.com
Wed Feb 4 10:37:22 EST 2009
"perfectionist" wrote :
|
| The problem was the injected reference to the stateless session bean was being called one time from inside the constructor for the backing bean.
|
|
I haven't used JSF, but i think you should be using the injected reference after @PostConstruct and not in the constructor of the managed bean.
public class MyBackingBean ...
| {
|
| @EJB
| private MyEJB ejb;
|
| public MyBackingBean()
| {
| ... // don't use the bean here, its not yet injected
| }
|
| @PostConstruct
| public void myPostConstruct()
| {
| // use the bean here, since this is called after
| // resources have been injected
| ejb.doSomething();
| }
| ...
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4207028#4207028
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4207028
More information about the jboss-user
mailing list