項目中報異常,信息如下:
The mapped handler method class XXXX is not an instance of the actual endpoint bean class XXXX
出現這種異常,很有可能是代理方式錯誤導致的。應該強制要求程序采用一種方式,要么是jdk基於接口的代理,要么是基於類的代理。
spring.aop.proxy-target-class=true
#自動代理關閉
spring.aop.auto=false
proxy-target-class屬性的作用
true表示基於類的代理將使用,false表示默認使用Jdk基於接口的代理
參考地址: