@AspectJ pointcut for execute methods of a package
Have a look here http://www.eclipse.org/aspectj/doc/released/adk15notebook/annotations-pointcuts-and-advice.html
@(org.xyz..*)
Matches any annotated element which has either an annotation of a type matching the type pattern(org.xyz..*)
. In other words, an annotated element with an annotation that is declared in the org.xyz package or a sub-package. (The parenthesis are required in this example).
So you should have the following aop config:
<aop:config>
<aop:advisor advice-ref="myAdvice" pointcut="execution(* com.mycompany..*(..))" order="1"/>
</aop:config>
and matching bean for this advice
<bean id="myadvice" class="com.mycompany.MyIntercetpor"/>
Interceptor should implement org.aopalliance.intercept.MethodInterceptor
Hemant Metalia
Great communication skills and rich domain knowledge with comprehensive understanding and practical knowledge of various languages, operating systems and databases. Reliable as a fully contributing, responsible and accountable member of task/project teams with highly creative, logical and analytical approach. Focused and hardworking and team oriented; with proven capability to meet coordinate multiple projects. Currently working as, a Technical architect at Publicis Sapient. About 11+ years of total experience working in various roles in software development. I have mainly worked in Java related frameworks and development platforms but I also have some experience of working in C, C++, javascript, angularJS projects. I am fast learner so new technology is not a barrier for me, I can adopt any technology, I consider myself as a professional programmer and given enough money can work on any programming language. Specialties: Application Development for Java platforms i.e. J2EE, Spring, Web Services, Cloud Computing and Research & Development etc. Communicate with me on : Linked In
Updated on June 05, 2022Comments
-
Hemant Metalia almost 2 years
I want to execute a execute method in a specific package.
What could be a possible pointcut for this?
Note: I am using @AspectJ style Spring AOP.