spring-boot配置readonly
生活随笔
收集整理的這篇文章主要介紹了
spring-boot配置readonly
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Apache Tomcat官方確認并修復了兩個高危漏洞漏洞,給出的臨時解決辦法是:
禁用HTTP PUT方法:
在Tomcat的web.xml 文件中配置org.apache.catalina.servlets.DefaultServlet的初始化參數;
?
spring boot中,可以通過bean配置的方式
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
}
private static class ContextSecurityCustomizer implements TomcatContextCustomizer {
@Override public void customize(Context context) {SecurityConstraint constraint = new SecurityConstraint();SecurityCollection securityCollection = new SecurityCollection();securityCollection.setName("restricted_methods");securityCollection.addPattern("/*");securityCollection.addMethod(HttpMethod.PUT.toString());//這里設置你想禁用的http methodconstraint.addCollection(securityCollection);constraint.setAuthConstraint(true);context.addConstraint(constraint); }}
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的spring-boot配置readonly的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Apache Avro
- 下一篇: tomcat web.xml配置