spring3.2 mvc @ControllerAdvice 不起作用




I found the solution for the above problem. Actually @ControllerAdvice needs MVC namespace declaration in XML file. Or we can use @EnableWebMvc with @ControllerAdvice annotation

@EnableWebMvc
@ControllerAdvice
public class BaseController {

	@ExceptionHandler()
	public void handleException(Exception e) {
		System.out.println("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr");

	}
}

.

猜你喜欢

转载自yjian84.iteye.com/blog/1921077