CDI : WELD-001408 Unsatisfied dependencies, how to resolve it?

前端 未结 4 1695
一生所求
一生所求 2021-01-01 13:24

I do a small test project with CDI. My application is composed of an EJB EAR and WAR, all deployed on Glassfish 4. I\'m using Hibernate 4.3.4 to access the database.

4条回答
  •  粉色の甜心
    2021-01-01 13:55

    Java EE 7 has implicit bean archives by default, i.e. a bean class requires a scope annotation to be discovered as CDI bean.

    @Named is not a scope annotation. Try @Dependent instead.

    beans.xml is no longer required in CDI 1.1/Java EE 7. If you do have one, then the exact version and the bean-discovery-mode make a difference. See the Bean archives section of the CDI 1.1 spec.

    As you didn't post your beans.xml, it's hard to tell whether or not this file is part of the problem.

提交回复
热议问题