java - creation of aspect similar to @Transaction in spring -
java - creation of aspect similar to @Transaction in spring -
i reading this link have doubt. here defining aspect getting called e.g. @pointcut("execution(* com.tutorialspoint.*.*(..))")
. if want fire aspect explicitly mention aspect or annotation, how that? illustration in particular method of class if annotate annotation particular aspect should called similar @transaction
in spring. how similar thing. thanks.
there perchance 2 annotatable points interested in: class and/or method.
if interested in class having particular annotation, can utilize @within(someannotationtype)
or within(@someannotationtype *)
. combine execution pick out execution of method in annotated type execution(* *(..)) && @within(someannotationtype)
if interested in particular method beingness annotated can utilize @pointcut("execution(@someannotationtype * *.*(..))")
. in case doesn't matter if type annotated. see annotation goes @ front end of method signature.
and can of course of study combine these two, spring does:
pointcut executionofmethodinannotatedtype: execution(* *(..)) && @within(myannotation); pointcut executionofannotatedmethod(): execution(@myannotation * *(..)); pointcut executionofinterestingmethod(): executionofmethodinannotatedtype() || executionofannotatedmethod();
java spring aspectj
Comments
Post a Comment