not particularly related to kotlin but… does anyo...
# spring
x
not particularly related to kotlin but… does anyone know how I can get a transaction on a
@SpringBootTest
Copy code
javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'merge' call
i
You’ll need
@DataJpaTest
or similar
x
… yeah but that alone? won’t inject my services
b
You can just add the
@Transactional
annotation on the test class/method. You'll get a test transaction you can commit/rollback manually: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/test/context/transaction/TestTransaction.html