Problems with Aop in spring boot

前端 未结 2 668
庸人自扰
庸人自扰 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:31

    Your allPublicMethods pointcut is too broad. It's being applied to every public method of every class. One class that matches is org.springframework.boot.autoconfigure.AutoConfigurationPackages$BasePackages. It's declared as final which prevents the advice from being applied to it.

    You should narrow the scope of your pointcut, for example by only applying it to code in your own com.example package:

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

提交回复
热议问题