[jboss-user] [JBoss Seam] - Constructor versus @Create annotation
gmanwani
do-not-reply at jboss.com
Mon Feb 12 22:06:59 EST 2007
Following is my current setup
|
| public abstract Foo {
|
| @In
| protected FooComp1 fooComp1;
| protected Foo foo;
|
| protected void init() {
| if (fooComp1 != null) {
| foo = "injection works";
| }
| }
|
| public class FooImpl1 {
|
| public Foo() {
| init();
| }
|
| }
|
| public class FooImpl2 {
|
| public Foo() {
| }
|
| @Create
| public void initchild() {
| init();
| }
|
| }
|
|
FooImpl1 and FooImpl2 are components which I define in the className.component.xml files with auto-create=true.
The interesting part is that when I create an instance of FooImpl2 injection works fine but in FooImpl1 (where my constructor calls init()) injection does not take place.
Can anyone explain why this is the case?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4015552#4015552
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4015552
More information about the jboss-user
mailing list