Problems with Aop in spring boot

前端 未结 2 667
庸人自扰
庸人自扰 2021-01-03 07:14

My Application class

import com.example.haha.Haha;
import com.example.hehe.Hehe;
import com.example.logging.Logging;
import org.springframework.beans.factory         


        
2条回答
  •  自闭症患者
    2021-01-03 07:49

    Your Pointcut is so generic:

    @Pointcut("execution(public * *(..))")
    

    That will advice all available public methods of every class on the classpath, every single of them! Unfortunately, Spring AOP can't make the required proxy for some present classes on the classpath (Since they're not implementing any interface and are final), hence the error:

    Cannot subclass final class org.springframework.boot.autoconfigure.AutoConfigurationPackages$BasePackages

    If you restrict your pointcut to just advice your classes, you would be fine!

提交回复
热议问题