Spring self-injection for transactions

In Spring, you cannot just call the @Transactional method from the same instance due to the AOP proxy thing. Would it be a good idea to do an independent injection and call this method from a self proxy instance? Do you see the flaws?

+5
source share
1 answer

This is normal. Moreover, to support this feature, there was a Jira ticket using @Autowired annotations. It is fixed in Spring 4.3+ versions. However, for an xml-based configuration or using the @Resource annotation @Resource it works in earlier versions.

You can see the discussion below this ticket. @Transactional one use case for this:

Particularly interested in the use cases of @Async and @Transactional.

+5
source

Source: https://habr.com/ru/post/1266471/


All Articles