Spring by default uses a proxy based AOP solution and as a result of that only Spring managed beans will be able to have those aspects applied. It will not work on non-spring managed beans. See this section of the reference guide.
You are trying to intercept the exection on a javax.
package which is a special case and will only work in a load-time weaving environment and not with a proxy-based or compile-time based solution. Also weaving them with loadtime weaving might also be tricky as those classes are probably already loaded before loadtime-weaving kicks in.
The aspect is fine, btw, it can catch other method invocations from my codebase.
Actually your aspect is flawed, an @Around
advice should always return Object
and should always return the result of calling the proceed()
method (unless you are rethrowing the Exception
. Your aspect breaks properly returning the result and now effectivly every method returns null
.
Links:
- Proxying Mechanisms | reference guide
- Load-time weaving with AspectJ in the Spring Framework | reference guide
- Around advice | reference guide