How to make a CDI bean lazily initialized?

前端 未结 3 1069
慢半拍i
慢半拍i 2021-01-05 17:23

I am using Weld implementation of CDI 1.0 and I cannot find way how to make bean lazy like in Spring (using @Lazy or lazy-init in XML). Is there a

3条回答
  •  鱼传尺愫
    2021-01-05 17:56

    See my answer on: http://www.adam-bien.com/roller/abien/entry/lazy_injection_with_javax_inject

    Using

     @Inject
    Instance object;
    

    the bean is initialized only when needed ... isn't that what you want?

提交回复
热议问题