Closed
Description
Aleksandr opened SPR-16550 and commented
When trying to autowire Spring Boot's TestEntityManager
in method annotated as @BeforeAll
, the following exception is thrown:
java.lang.IllegalStateException: No transactional EntityManager found
Other beans are autowired into this method without problems.
The case is following - since I have one test class instance for all tests in it, and they require the same prepopulated DB, why not fill the DB once after test class instantiation?
Sample project is referenced in the issue.
Issue Links:
- Execute all test methods in a class within the same transaction [SPR-5520] #10191 Execute all test methods in a class within the same transaction ("duplicates")