java.lang.IllegalArgumentException: At least one handler method must be found in class [class SayThr

log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
java.lang.IllegalArgumentException: At least one handler method must be found in class [class SayThrowAdvice]
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.(ThrowsAdviceInterceptor.java:94)
at org.springframework.aop.framework.adapter.ThrowsAdviceAdapter.getInterceptor(ThrowsAdviceAdapter.java:38)
at org.springframework.aop.framework.adapter.DefaultAdvisorAdapterRegistry.getInterceptors(DefaultAdvisorAdapterRegistry.java:84)
at org.springframework.aop.framework.DefaultAdvisorChainFactory.getInterceptorsAndDynamicInterceptionAdvice(DefaultAdvisorChainFactory.java:62)
at org.springframework.aop.framework.AdvisedSupport.getInterceptorsAndDynamicInterceptionAdvice(AdvisedSupport.java:453)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:190)
at com.sun.proxy.$Proxy0.sayHello(Unknown Source)

at Test.main(Test.java:15)

仔细检查,原来是

public class SayThrowAdvice implements ThrowsAdvice {
public void AfterThrowing(Method method,Object[] objs,Object target,Throwable ta){
System.out.println("Exception happened"+ta+"and was thrown in "+method);
}
}

内的A大写了,改为小写即可。

上海名汇软件信息科技有限公司,有意者请加QQ457475013!

你可能感兴趣的:(Spring)