Unable to autowire the service inside my authentication filter in Spring

后端 未结 6 2179
无人及你
无人及你 2020-11-29 23:11

I am trying to authenticate user by token, But when i try to auto wire one my services inside the AuthenticationTokenProcessingFilter i get null pointer excepti

6条回答
  •  清歌不尽
    2020-11-29 23:40

    You can configure your bean filter and pass as a parameter whatever you need. I know out of Spring context where the filter it is, you cannot get the dependency injection that the auto-scan of spring does. But not 100% sure if there´s a fancy annotation that you can put in your filter to do some magic stuff

       
       YourFilter
           org.springframework.web.filter.DelegatingFilterProxy
        
    
    
       YourFilter
           /*
        
    

    and then inject bean in the spring.xml

      
         
            values
         
      
    

提交回复
热议问题