SpringBoot常见报错及解决方法

问题一

Field redisUtil in com.sui.demo.controller.redisController required a bean of type 'com.sui.demo.util.RedisUtil' that could not be found

原因:

未扫描到RediUtil包,无法用spring ioc容器自动创建对象

解决方法一:

去掉@Autowired注解,手动创建对象 private JedisPool jedisPool= new JedisPool();

解决方法二:

启动类手动添加扫描该包

猜你喜欢

转载自www.cnblogs.com/lynnetest/p/10899120.html