1.修改tomcat配置文件conf的web.xml(增加红色部分)
2.新增如下内容
<security-constraint>
<web-resource-collection>
<url-pattern>/*</url-pattern>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>HEAD</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
原配置文件下载:
链接:https://pan.baidu.com/s/16-63SXgsOOdA8ScLXkbpqA
提取码:eg87