April 2018
Intermediate to advanced
246 pages
6h 11m
English
Spring provides another mechanism to define advice and aspect as a single unit. It's called an advisor. It's only available in Spring AOP and not in native AspectJ. In this model, you need to define advice as a class that implements one of the advice interfaces. An advisor can be defined with the <aop:advisor> element in the application context (XML) file as follows:
<aop:config> <aop:pointcut id="loggingPointcut" expression="execution(* com.packt.spring.aop.dao.*.*(..))" /> <aop:advisor advice-ref="loggingAdvice" pointcut-ref="loggingPointcut" id="loggingInterceptorAdvisor" /></aop:config><bean id="loggingAdvice" class="com.packt.spring.aop.advisor.LoggingAdvisor" />
You need to define an advisor with the <aop:advisor> ...