Spring AOP superclass method execution without @target

Consider the following situation:

class A() {
    void a();

class B extends A {
    void b();

I want to advice all methods of all classes annotated with @MyAnnotation (i.e B.a()). That's pretty easy task due to the possibility of using @target pointcut expression. BUT! in that case all beans in a container (even unsuitable) will be Proxified what is unacceptable.

Now the question: Is it possible to build up pointcut expressino without @target but with the same effect?


You can use within like this.

execution(* *(..)) && within(@MyAnnotation *)

refer to http://stackoverflow.com/a/2522821/672586 and http://forum.springsource.org/showthread.php?28525-Difference-between-target-and-within-in-Spring-AOP for more details. The relevant section from the forum post explaining the difference between within and target

One difference between the two is that @within() is matched statically, requiring the corresponding annotation type to have only the CLASS retention. Whereas, @target() is matched at runtime, requiring the same to have the RUNTIME retention. Other than that, within the context of Spring, there is no difference between the join points selected by two.

Need Your Help

draw the depth value in opengl using shaders

opengl shader

I want to draw the depth buffer in the fragment shader, I do this:

Multiple parameters in MyBatis?

java mybatis

I know this question is asked many times and I still get problems when I follow the guide when including multiple parameters in my select query. Here is my configuration file:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.