springboot 搭建 web 框架很是方便,但是搭建的过程中会遇到很多问题.过程中我遇到了这样一个问题 如下:
错误如下
2017-01-06 18:28:23.933 ERROR 80102 --- [nio-8088-exec-6]
o.s.boot.web.support.ErrorPageFilter : Cannot forward to error page for
request [/strategy/list/] as the response has already been committed. As a
result, the response may have the wrong status code. If your application is
running on WebSphere Application Server you may be able to resolve this
problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false
遇到这个错误纠结了很久.. 显示设置了com.ibm.ws.webcontainer.invokeFlushAfterService
为false
, 如下
public MainApplication(){
super();
setRegisterErrorPageFilter(false);
}
或者
@Bean
public ErrorPageFilter errorPageFilter() {
return new ErrorPageFilter();
}
@Bean
public FilterRegistrationBean disableSpringBootErrorFilter(ErrorPageFilter filter) {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
filterRegistrationBean.setFilter(filter);
filterRegistrationBean.setEnabled(false);
return filterRegistrationBean;
}
虽然没有错误了但是又遇到了404 错误.
这样的错误,好比当年用 servlet 的时候,说什么 response 已经使用,而再次使用,或者路径已经转发,你却在转发之后用 response 等等这样的问题,,在 springboot 中,我也以为是这样的问题,,,其实答案很简单 就是找不到这个 url!!!! 路径写错了而已 ...