• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A question about spring aop annotation.

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Given the following example,
Before("execution(* aop.x.Store.*(..))"+"&&target(store)")
public void sayHelloAspect(Store store){}

I purchased the membership from learnnowjava.com and the teacher said that the aspect will match if and only if the called method has a parameter of type Store, and it will be given the name "store" so it can be accessed in the sayHelloAspect() .

Here is my questions,
intuitively I assume the purpose to use target() is to get the target object of the method invocation ,that is,the bean .And if you only want to get the parameter in the called method, why not use args() instead of target()?
Does it mean that you can either get the target object of the method invocation(in this example ,the type of the parameter in sayHelloAspect() will be changed to Object) or get the arg of the declared type in the advice ? Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic