Spring Security without web.xml

前端 未结 7 1523
不思量自难忘°
不思量自难忘° 2021-01-30 15:06

What is the recommended way to add Spring Security to a web application that is using Spring\'s new WebApplicationInitializer interface instead of the web.xml file?

7条回答
  •  误落风尘
    2021-01-30 15:28

    This is the way that I have done it:

    container.addFilter("springSecurityFilterChain", new DelegatingFilterProxy("springSecurityFilterChain"))
                        .addMappingForUrlPatterns(null, false, "/*");
    

    container is an instance of ServletContext

提交回复
热议问题