- Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Affects: 6.0.4
When class annotated with @Transactional annotation is registered in @Configuration class no actual transaction is started when calling methods while running in native image. When the same class is registered with @Service annotation everything works as expected. Both cases work fine in standard (non-native) run. This used to work in experimental version of spring-native but required manual registration of @Transactional beans.
Provided example uses Spring Boot 3.0.2 for ease of configuration and when run in native mode the following exception occurs:
jakarta.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'merge' call
The class implements an interface and the interface is injected in CommandLineRunner and a method is called to save the entity.