This content has been marked as final.
Show 2 replies
-
1. EJB3 and Struts2 with CDI ?
jaikiran Apr 10, 2011 2:16 AM (in response to rop)The main difference to a plain servlet, is that the action-classes in Struts2
are created on-the-fly (... new myActionclass() ...) everytime a request comes in,
and @EJB doesnt work for such classes.
Struts action classes are not container managed classes. So container managed injection like @EJB will not work there.
But I read somewhere that CDI should be able to handle Dependency-Injection in POJOs created on-the-fly....
Is that correct?
Even with CDI, if you do a new SomeClass() then there won't be any scope for injection.
-
2. EJB3 and Struts2 with CDI ?
djheisterberg Apr 10, 2011 4:39 PM (in response to rop)You need to provide a struts ObjectFactory, like this: http://www.mail-archive.com/dev@struts.apache.org/msg35308.html//www.mail-archive.com/dev@struts.apache.org/msg35308.html