I have a UserDetailsService class annotated with @Service. I also have DAO classes annonated which are autowiring and working fine within my controllers.
The problem is when I want to wire up the UserDetailsService bean within my security-context.xml. Spring is unable to find the bean. Is it because my component-scan is in my controllers.xml file and out of the scope of my security configuration?
xml config file 开发者_如何学编程layout as so :
web.xml :
<context-param>
    <param-name>contextConfigLocation</param-name>
        <param-value>
              /WEB-INF/spring/root-context.xml
              /WEB-INF/spring/appServlet/security-context.xml
        </param-value>
</context-param>
servlet-context.xml :
...
<beans:import resource="controllers.xml" />
...
Yes, you'll need to add the component scan to both contexts, it's not enough to do it in just one.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论