Is it possible to create a pointcut for SpringBean Serializable ?
I want to intercept writeObject and readObject of my controllers with the syntax:
execution(* ((@org.springframework.stereotype.Controller java.io.Serializable)+).*(..))
I think the problem is readObject/writeObject is private and called in a different way. Any suggestion ?
The thing is: Spring AOP won’t be able to match these pointcuts. Spring AOP only matches pointcuts on public methods. You will need AspectJ compilation or Load Time Weaving to get this to work.
Source: 8.2.3.1. Supported Pointcut Designators
And before you ask: making the methods public won’t help either, because they will be called by the Java serialization mechanism, not by Spring, so Spring AOP is not aware of what’s happening.