Spring MVC中的ExceptionResolver没有注释

时间:2014-09-05 03:11:06

标签: java spring spring-mvc exception-handling exceptionhandler

如何捕获spring-3.0 mvc应用程序中的所有异常?

我试过这样的事情:

public class CustomExceptionResolver extends SimpleMappingExceptionResolver { ... }

<bean class="com.web.controller.CustomExceptionResolver" autowire="byName">
    <property name="exceptionMappings">
        <props>
            <prop key="java.lang.Exception">uncaughtException</prop>
        </props>
    </property>
</bean>

但是每当遇到异常时,它仍然没有进入那个类。 我无法使用注释(例如@Controller@ExceptionHandler@ControllerAdvice

最后,如何在没有注释的情况下使用@ControllerAdvice?感谢。

0 个答案:

没有答案