当我使用Spring Security自动配置Spring Spring应用程序打包为war并部署到Tomcat并尝试访问不存在的URL时,我得到了
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Mar 07 18:14:22 CET 2017
There was an unexpected error (type=Internal Server Error, status=500).
getOutputStream() has already been called for this response
我准备了最小的例子来重现它here
没有Logbook它按预期工作 - 需要基本身份验证
没有Spring Security它按预期工作 - 未找到错误消息
当打包为带有嵌入式Tomcat的jar时,它可以完美地运行
只有在访问不存在的URL时才会出现问题 - 如果我的示例中有任何控制器,则您也无法访问它们。