aspose file tools*
The moose likes Spring and the fly likes Spring aspects annotatted parameter question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring aspects annotatted parameter question" Watch "Spring aspects annotatted parameter question" New topic
Author

Spring aspects annotatted parameter question

Jeremy Odell
Greenhorn

Joined: Mar 30, 2011
Posts: 4
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

Joined: Mar 30, 2011
Posts: 4
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

Joined: Feb 05, 2001
Posts: 17249
    
    6

Try

@args(packagehere.TestParam)

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring aspects annotatted parameter question
 
Similar Threads
AspectJ LTW using Spring
Spring AOP around advice for Managing Hibernate Session
Spring AOP with mvc
Spring Aspect Question
Getting method name on spring AOP @Before