Spring AOP (Aspect) Not executing

前端 未结 6 678
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 08:18

I ams using Spring 2.5.6, asm 1.5.3, aspectjrt/aspectjweaver 1.6.1, cglib 2.1_3 In my Web based Spring application I have following class:

package uk.co.txttools         


        
6条回答
  •  清歌不尽
    2021-02-05 09:02

    For those who opted for JavaConfig, you can declare your Aspect as a bean and add the @EnableAspectJAutoProxy annotation to turn on auto-proxying :

    @Configuration
    @EnableAspectJAutoProxy
    @ComponentScan
    public class MyConfig {
        @Bean
        public LoggingAspect loggingAspect(){
            return new LoggingAspect();
        }
    }
    

提交回复
热议问题