@Autowired object gets a null value in one class, while successfully wired in another

前端 未结 5 1106
小鲜肉
小鲜肉 2021-02-19 01:32

I am working on a project using Spring 3, and Spring Security. My problem is with IoC container. Problem started when I wrote my own implementation of UserDetailsService

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-19 02:00

    Since the second bean is not in the specified bean annotation package component scan as specified in project-servlet.xml:

    
    

    it does not consider it to be a service and does not translate the annotations.

    You need to extend it further or move it to a package starting with com.project or else like this:

    
    

提交回复
热议问题