Aspect Configuration
Same as any other Java Pojo class, the Aspect annotated class also can be used as given below
@Bean
public Passenger passenger() {
return new Passenger();
}
By using the @EnableAspectJAutoProxy we can turn the proxy on in Java based Configuration
@Configuration
@EnableAspectJAutoProxy
@ComponentScan
public class FlightConfig {
@Bean
public Passenger passenger() {
return new Passenger ();
}
}
If you will not annotate the class with the @EnableAspectJAutoProxy then your class Passenger
will be a simple pojo class only. It won't be Aspect.
In XML based configuration add below line for turning on the proxy
<aop:aspectj-autoproxy />