开发者

Spring: Check present interceptors

开发者 https://www.devze.com 2023-03-20 09:48 出处:网络
Is there a way to check which interceptors are present for the current method? An example: if I am debugging the following method (any line in the method)

Is there a way to check which interceptors are present for the current method?

An example: if I am debugging the following method (any line in the method)

@OpenSession
@Transactional
public void run() {
    // do something ... 
}

is it possible to check that the @OpenSession and @Transactional intercept开发者_StackOverflow社区ors are actually doing their work?


Sure: set a breakpoint in one of the Aspect classes.

You can debug Spring AOP with any IDE and real aspectj with Eclipse's AspectJ Developer Tools (which are included in the SpringSource ToolSuite.


You need to write a test (Test driven Design) that verify the side effect of the annotation you want to have.

The test should fail without annotation, and should pass if the annotation trigger the action you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消