我是直接把配置文件复制到项目中的;
然后junit测试,一直提示报错:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.lian.service.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
刚开始不知道什么原因,打开配置文件的时候,发现 扫描包的信息忘记改了;
注解扫描不到你的bean,当然会报NoSuchBeanDefinitionException