No transactional EntityManager available

前端 未结 3 1874
轮回少年
轮回少年 2021-01-13 06:52

I am new to the jpa and spring world and I am currently doing some unit test on a simple method but keep getting this error message only when I run my test class in unit tes

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-13 07:40

    I got a similar problem when I try the unit tests with IntelliJ, even though its working using cli of maven-surefire-plugin

    it turns out that IntelliJ build was using javac compiler and even though it specified in pox.xml to use ajc compiler there is a reported bug for IntelliJ at IDEA-135483

    that made @Transactional not working and give you No transactional EntityManager available

    if that is your case, you need to change java compiler to use ajc instead of javac and post-compile weave mode in project structure

提交回复
热议问题