Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring aspects annotatted parameter question

 
Jeremy Odell
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to annotate a parameter in a method and then have my advice successfully read this. However I cannot seem to get the @args to work properly.

Here is an example of the method with the annotated param:


The working advice looks like this:


However instead of args I would like to use the @args value and look for the annotation.
When I attempt to do this, it does not get into the advice:



My goal is to mark a parameter with an annotation so that in my advice i can easily gain access to the object I want to use. Is this possible? It does not seem to be working the way I would assume.

Thanks in advance,
Jeremy
 
Jeremy Odell
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more additional interesting find. It seems as though the Joinpoint object does not have any annotation details.
I ran the following test:



I could not get back any annotation information from the joinpoint. I had to use Spring's ClassUtil to get back the info I expected.

I wonder if this is why I could never get a value when using @args?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try

@args(packagehere.TestParam)

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic