- spring-boot Exception 처리
https://zzangjava.tistory.com/926?category=774099
- @ControllerAdvice annotation 을 이용한 Exception 처리
http://ranestar.tistory.com/14
<annotation-driven />
<context:component-scan base-package="net.krespo" >
@ControllerAdvice
public class AnnotationExceptionHandler{
private final Logger logger = LoggerFactory.getLogger(AnnotationExceptionHandler.class);
@ExceptionHandler(value=Exception.class)
public ModelAndView handleException(Exception e) {
logger.info("Exception발생");
logger.error("Exception", e);
e.printStackTrace();
ModelAndView model = new ModelAndView();
model.addObject("exceptionMsg", "Exception발생");
model.addObject("methodName", "handleException");
model.setViewName("exception");
return model;
}
@ExceptionHandler(value=RuntimeException.class)
public ModelAndView handleRuntimeException(RuntimeException e) {
logger.info("RuntimeException발생");
logger.error("RuntimeException", e);
e.printStackTrace();
ModelAndView model = new ModelAndView();
model.addObject("exceptionMsg", "RuntimeException발생");
model.addObject("methodName", "handleRuntimeException");
model.setViewName("exception");
return model;
}
@ExceptionHandler(value=BaseException.class)
public ModelAndView handleBaseException(BaseException e) {
logger.info("BaseException발생");
logger.error("BaseException", e);
e.printStackTrace();
ModelAndView model = new ModelAndView();
model.addObject("exceptionMsg", "BaseException발생");
model.addObject("methodName", "handleBaseException");
model.setViewName("exception");
return model;
}
====================================================================================================
- ExceptionResolver를 이용한 Exception 처리
http://mspark7233.blogspot.kr/2014/04/exception-resolver.html
https://groups.google.com/forum/#!msg/ksug/5xeN3gDSbu8/lvuzQ-eN3-MJ
http://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc
https://code.google.com/p/developerhaus/wiki/SpringException
====================================================================================================
- 스프링에서 SQLException 처리
http://secr.tistory.com/282
- jsp 공통 에러페이지 설정
- enum을 사용한 에러메시지 코드화
http://homo-ware.tistory.com/m/116
- Spring에서 404 에러 처리하기
http://aodis.egloos.com/m/5965716
- Spring MVC 예외처리
http://springboot.tistory.com/25
http://springboot.tistory.com/33
http://blog.chakannom.com/2016/01/spring-exception-exceptionhandler.html?m=1
====================================================================================================
'spring' 카테고리의 다른 글
파일업로드&다운로드 (0) | 2015.11.07 |
---|---|
response cache 제거 (0) | 2015.11.07 |
spring IoC, DI (0) | 2015.11.01 |
util:properties, properties.xml 사용 및 확장 (0) | 2015.11.01 |
[jackson] Jackson이용한 json, xml 리턴 (0) | 2015.08.03 |