Search code examples
spring-bootspring-transactions

Spring Boot: Call your own RestController transactionally


I have Spring Boot app which exposes various Rest API endpoints. I would like to call multiple of these endpoints from the application itself using RestTemplate in one transaction. Is that possible?

Thanks for any advice.


Solution

  • If you want to call them from same application, can't you just skip RestTemplate and call your methods directly? Just @Autowired your controllers classes and call their methods sequentially in one transaction.