sts4 icon indicating copy to clipboard operation
sts4 copied to clipboard

Warning when annotated methods are self-invocated from within its own class

Open MahatmaFatalError opened this issue 1 year ago • 0 comments

Expected Behavior

Given the example

1    @Transactional
2    public void foo() {
3        ...
4    }
5
6    public void bar() {
7        this.foo();
8    } 

when calling bar(), foo() will not be executed in a transaction, because AOP only works with calls from outside the class AFAIK. The same applies probably for other annotations like @Cacheable.

I would expect from my IDE to be warned or at least informed about this situation. So in the line 7 I would expect a marker.

Current Behavior

No hints at all. You need to know what is going on.

Context

The situation is simply error-prone for inexperienced devs. A simple info or warning marker could help resolving the risk.

MahatmaFatalError avatar Feb 21 '24 09:02 MahatmaFatalError