spring boot项目中ErrorPage错误问题
发布日期:2021-07-27 12:52:49 浏览次数:3 分类:技术文章

本文共 898 字,大约阅读时间需要 2 分钟。

1.问题描述

在springboot编程中,访问某一页面地址时,有时候会遇到这样的错误提示:

[org.springframework.boot.web.support.ErrorPageFilter:208] - Cannot forward to error page for request [/user] 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

这个问题在我的项目中并不是每次都会出现,具体原因尚不清楚。

2.解决方法

在项目启动类中添加如下配置:

@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;    }

 

转载地址:https://blog.csdn.net/rhx_1989/article/details/81091990 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:谷歌浏览器中全屏及跳过页面打印预览的设置
下一篇:使用jOrgChart插件生成树形图

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2024年03月29日 21时01分12秒