CDI / Weld SE - @Observes ContainerInitialized doesn't work
I have Weld SE, bootstraped this way:
WeldContainer weld = new Weld().initialize();
And the following bean
@ApplicationScoped
public class EntityManagerStoreImpl implements EntityManagerStore {
static { System.out.println(" AAAAAA EMSI static"); }
public EntityMana开发者_如何转开发gerStoreImpl() {
System.out.println(" AAAAAA EMSI constructor");
}
public void init( @Observes ContainerInitialized containerInitialized ) {
System.out.println(" AAAAAA EMSI init");
}
...
}
According to Weld docs, the init()
method should be called.
But it's not. Other beans are working fine.
Oh... I should have read the docs more carefuly.
ContainerInitialized
is currently only fired from StartMain helper class.
I don't like that, I'd expect it to be fired from Weld.initialize()
.
So I created https://issues.jboss.org/browse/WELD-949
(Pls vote if you share this oppinion with me.)
精彩评论