| Author |
Spring Aspect Question
|
Jeremy Odell
Greenhorn
Joined: Mar 30, 2011
Posts: 4
|
|
I am in the process of using the @AfterReturning advice. I have set this up to be used for an annotation I have created. The advice looks like:
Now I have set up my Annotation to have certain parameters set. I would like to use these in the above advice.
How do I pass in the annotation?
Thanks,
Jeremy
|
 |
Mark Spritzler
ranger
Sheriff
Joined: Feb 05, 2001
Posts: 16624
|
posted

0
|
Hi Jeremy.
Using the @Annotation designator or, if it is an argument that is annotated, then the @Args, or if it is the target that is Annotated then @Target.
In your case it would be @Annotation, so in your Pointcut Expression you add the @Annotation designator with an "and" or "&&"
so
execution(@com.rbs.etspii.aspects.CheckAssetType com.rbs.base.common.RBSValidationResult submit*(..)) && @Annotation(assetType)"
Now in your advice method you can have the parameter
myAdviceMethod(ResultType result, CheckAssetType assetType)
Like this taken from the SpringFramework documentation
And then the advice that matches the execution of @Auditable methods:
Mark
|
Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
|
 |
Jeremy Odell
Greenhorn
Joined: Mar 30, 2011
Posts: 4
|
|
Thanks Mark, that was it.
|
 |
 |
|
|
subject: Spring Aspect Question
|
|
|