How to use JUnit tests with Spring Roo? (Problems with EntityManager)

后端 未结 7 514
忘了有多久
忘了有多久 2021-01-02 19:40

I\'m trying to write a JUnit test for a Spring Roo project. If my test requires use of the entity classes, I get the following Exception:

java.lang.IllegalS         


        
7条回答
  •  再見小時候
    2021-01-02 20:19

    ponzao is correct. I am able to have all the spring injection magic by having my test class extend AbstractJunit4SpringContextTests.

    e.g.

    @ContextConfiguration(locations = { "/META-INF/spring/applicationContext.xml" })
    public class SelfRegistrationTest extends AbstractJUnit4SpringContextTests {
    

提交回复
热议问题