开发者

CDI / Weld SE - @Observes ContainerInitialized doesn't work

开发者 https://www.devze.com 2023-03-22 12:42 出处:网络
I have Weld SE, bootstraped this way: WeldContainer weld = new Weld().initialize(); And the following bean

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.

What can be wrong?


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.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号