How to inject a CDI Bean in a ManagedBean?

后端 未结 3 1824
我在风中等你
我在风中等你 2021-01-02 23:12

I want to inject a CDI Bean in a ManagedBean either with the annotation @Inject or @Produce. The CDI Bean which I use is:

@Named
@Startup
@ApplicationScoped
         


        
3条回答
  •  失恋的感觉
    2021-01-02 23:31

    If you are using @ManagedBean use @ManagedProperty to inject properties:

    @ManagedProperty(value = "#{baseBean}")
    private BaseBean dBean;
    
    // getter and setter
    

提交回复
热议问题