配置问题
报错一
java.lang.IllegalStateException: Failed to load ApplicationContext
一边出现这种情况都是配置写错了 你可以仔细看看你的xml配置
我是由于mybatis的mapper文件下的xml 所映射的user类写成了User类
报错二
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'xxx': Unsatisfied dependency expressed through field 'xxx'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'xxx' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)
在对service类进行单元测试的发现怎么样都无法进行通过
最后对service的impl实现类前面加上了 @Service
报错三
Error creating bean with name 'xxx':
发现怎么样都找不到bean, 就怀疑springboot没有注入bean,在springboot启动类加入了这一句注解
@ComponentScan(basePackages = {“com.anthony1314.xxx.xxx”})
第一个xxx 代表你的项目名
第二个xxx 代表你想扫描的包