April 2018
Intermediate to advanced
246 pages
6h 11m
English
The concept of declaring Aspect with the @AspectJ annotation style is somewhat similar to XML schema-based AOP declaration. Just to recall, a Java class can be an Aspect in the Spring AOP framework. In annotation-based Spring AOP, you can declare any bean as an Aspect with the @Aspect annotation as follows:
package com.packt.spring.aop.aspects;import org.aspectj.lang.annotation.Aspect;import org.aspectj.lang.annotation.Pointcut;@Aspectpublic class SessionCheck {}
The SessionCheck class is defined as a regular Spring bean in the application context (XML) file as follows:
<aop:aspectj-autoproxy/><bean id="sessionCheckAspect" class="com.packt.spring.aop.aspects.SessionCheck"></bean>
Aspect classes may have methods and fields ...