Adding ContextLoaderListener to web.xml in Spring MVC

后端 未结 4 610
执笔经年
执笔经年 2020-12-01 06:39

I am new to Spring MVC. I have a web application. I have the following configuration:



        
4条回答
  •  被撕碎了的回忆
    2020-12-01 07:14

    It is optional, you don't really need it just for Spring MVC (DispatcherServlet will do). But adding Spring security to your Spring MVC must be done with

    
            org.springframework.web.context.ContextLoaderListener
    
    

    Just one remark, if using ContextLoaderListener you will have to add DelegatingFilterProxy:

    
        
            org.springframework.web.context.ContextLoaderListener
        
    
    
    
        springSecurityFilterChain
        org.springframework.web.filter.DelegatingFilterProxy
    
    
        springSecurityFilterChain
        /admin
    
    
    
        contextConfigLocation
             
        /WEB-INF/spring-security.xml
        
    
    

    in your web.xml as well. Sorry for being four years too late. Cheers

提交回复
热议问题