I need to create an aspect with a pointcut matching a method if:
- Is public
- Its class is annotated with @Controller (Finally does not)
- One of its parameters (can have many) is annotated with @MyParamAnnotation.
I think the first two conditions are easy, but I don't know if its possible to accomplish the third with Spring. If it is not, maybe I can change it into:
- One of its parameters is an instance of type com.me.MyType (or implements some interface)
Do you think it's possible to achieve this? And will performance be good?
Thanks
EDIT: One example of a matching method. As you can see, MyMethod is not annotated (but it can be).
@Controller
public class MyClass {
public void MyMethod (String arg0, @MyParamAnnotation Object arg1, Long arg3) {
...
}
}
EDIT: The solution I finally used, based on @Espen answers. As you can see, I changed my conditions a little: class doesn't actually need to be a @Controller.
@Around("execution(public * * (.., @SessionInject (*), ..))")
public void methodAround(JoinPoint joinPoint) throws Exception {
...
}