Whether LettuceConnectionFactory have version restrictions on redis and springboot?

落爺英雄遲暮 提交于 2019-12-05 22:03:03

The NullPointerException is occurring because LettuceConnectionFactory has not been initialised. It should be initialised by Spring Framework calling afterPropertiesSet() which is one of the standard bean lifecycle methods. That method isn't being called as your LettuceConnectionFactory isn't a bean due to a missing @Bean annotation on RedisConfig.lettuceConnectionFactoryTest().

Adding @Bean on RedisConfig.lettuceConnectionFactoryTest() should solve your problem. It will also allow you to inject LettuceConnectionFactory directly (into an @Autowired field in your test) rather than injecting RedisConfig and then calling lettuceConnectionFactoryTest() on it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!