springboot - 사용자 정의 이상 프로세서

710 단어 json자바
@Order(-1000)
public class LocalExceptionResolver implements HandlerExceptionResolver {

	@Override
	public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
	Exception ex) {
		return new ModelAndView();
	}

	private void responseResult(HttpServletResponse response, AppData result) {
		response.setCharacterEncoding("UTF-8");
		response.setHeader("Content-type", "application/json;charset=UTF-8");
		response.setStatus(200);
		try {
			response.getWriter().write(JSON.toJSONString(result));
		} catch (IOException ex) {
	}
}

}

  
다음으로 전송:https://www.cnblogs.com/lichangyunnianxue/p/9707658.html

좋은 웹페이지 즐겨찾기