一:SpringBoot:redisClient in e.test.serviceImpl.RedisServiceImpl required a bean of type ‘com.examp
1:没有自动注入导致。
service类上面没有@service注解或者mapper上没有@Repository注解,但是这种情况比较少见,一般不会忘记。
2:配置了mybatis,但没有指定扫描的包。
(1)直接在生成出来的xxxMapper.java类上加@Mapper标签。
(2)启动类加注释:@MapperScan(value={"com.example.test.mapper"}),表示扫描xx.xx.mapper包下的所有mapper。
3:@Component注解的类没有自动被Spring扫描到生成Bean注册到spring容器中
该注解被没有被spring识别,问题的核心关键就在application类的注解SpringBootApplication上。
(1)查看对应类是否加了注解@Component
(2)application启动类上增加标签 @ComponentScan(basePackages = {"com.sinosoft.channel.redis"}) ,手动指定 application类需要加载哪些路径下的注解。
@MapperScan:
@Mapper:在接口上添加了@Mapper,在编译之后就会生成相应的接口实现类。
不过需要在每个接口上面进行配置,为了简化开发,就有了 @MapperScan。
@ComponentScan: