InterviewSolution
| 1. |
What Do You Have To Do To Enable The Detection Of The @aspect Annotation? |
|
Answer» To use @ASPECTJ aspects in a SPRING configuration you need to enable Spring support for CONFIGURING Spring AOP based on @AspectJ aspects, and autoproxying beans based on whether or not they are advised by those aspects. ENABLING @AspectJ Support with Java configuration To enable @AspectJ support with Java @Configuration add the @EnableAspectJAutoProxy annotation: @Configuration @EnableAspectJAutoProxy public class AppConfig { } Enabling @AspectJ Support with XML configuration To enable @AspectJ support with XML based configuration use the <aop:aspectj-autoproxy/> element: <aop:aspectj-autoproxy/> To use @AspectJ aspects in a Spring configuration you need to enable Spring support for configuring Spring AOP based on @AspectJ aspects, and autoproxying beans based on whether or not they are advised by those aspects. Enabling @AspectJ Support with Java configuration To enable @AspectJ support with Java @Configuration add the @EnableAspectJAutoProxy annotation: @Configuration @EnableAspectJAutoProxy public class AppConfig { } Enabling @AspectJ Support with XML configuration To enable @AspectJ support with XML based configuration use the <aop:aspectj-autoproxy/> element: <aop:aspectj-autoproxy/> |
|