spring autowiring not working

后端 未结 2 950
挽巷
挽巷 2021-02-07 21:46

Hi, I am using spring 3.0 with Quartz in a scheduler class. I have created the application context by

private static final ClassPathXmlApplicationContext appli         


        
2条回答
  •  耶瑟儿~
    2021-02-07 22:26

    You haven't provided the UserService class source code so I can't be sure about your problem. Looks like the UserService class is missing a 'stereotype' annotation like @Component or @Service. You also have to configure the Spring classpath scanning using the following configuration:

        
        
    
                   
         
    
       
    

    Your beans must include one of the Spring stereotype annotations like:

    package your.package;
    
    @Service
    public class UserService{
    }
    

提交回复
热议问题