File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring aspects annotatted parameter question" Watch "Spring aspects annotatted parameter question" New topic

Spring aspects annotatted parameter question

Jeremy Odell

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 Odell

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

Joined: Feb 05, 2001
Posts: 17276




Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Spring aspects annotatted parameter question
It's not a secret anymore!