您的当前位置:首页正文

Null return value from advice does not match primitive return type for 错误解决

2024-11-30 来源:个人技术集锦
Exception in thread "main" org.springframework.aop.AopInvocationException: Null return value from advice does not match primitive return type for: public int com.fanling.xmlaop.UserDaoImpl.addUser(com.fanling.xmlaop.User)
	at org.springframework.aop.framework.CglibAopProxy.processReturnType(CglibAopProxy.java:391)
	at org.springframework.aop.framework.CglibAopProxy.access$000(CglibAopProxy.java:84)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:690)

这个错就是返回的类型不匹配。

造成的原因:

目标类的方法有返回值,而around环绕方法没有返回值

显示全文