焊接(CDI)+ JPA [英] WELD (CDI) + JPA
问题描述
我尝试运行在这里找到的示例: 使用CDI/Weld注入JPA/休眠实体管理器
I try to run the example I found in here: Using CDI/Weld to Inject JPA/Hibernate Entity Managers
我得到了错误:
WELD-001408:Unsatisfied dependencies for type EntityDao<User> with qualifiers @Named
at injection point [BackedAnnotatedField] @Inject @Named private com.payby.user.UserIdentityDao.baseEntityDao
WELD-001408:Unsatisfied dependencies for type EntityDao<User> with qualifiers @Named
at injection point [BackedAnnotatedField] @Inject @Named private com.payby.user.UserIdentityDao.baseEntityDao
,我也尝试从以下示例运行示例: https://bpm.zciok.blog/2017/08/17 /hibernate-cdi-example/
and also I tried to run the example from: https://bpm.zciok.blog/2017/08/17/hibernate-cdi-example/
但是我遇到了同样的错误.谁能帮助我了解为什么以及如何解决它.
but I got the same error. can anyone help me understand why and how I can resolve it.
谢谢, 艾夫纳(Avner)
thanks, Avner
推荐答案
For https://bpm.zciok.blog/2017/08/17/hibernate-cdi-example/ do the following changes in pom.xml, please
添加persistence-api依赖项
add persistence-api dependency
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
删除范围:从依赖项到休眠状态
remove scope:provided from dependencies to hibernate
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${version.hibernate}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.1.1.Final</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${version.hibernate}</version>
<!--<scope>provided</scope>-->
</dependency>
这篇关于焊接(CDI)+ JPA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!