关于redis session报错

昨天在对项目进行codis替换成redis时发生了一个错误,错误信息如下:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.session.SessionAutoConfiguration$SessionRepositoryValidator': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No Spring Session store is configured: set the 'spring.session.store-type' property

因为之前的codis使用了@EnableRedisHttpSession(maxInactiveIntervalInSeconds =86400)注解,替换成redis之后并没有添加该注解,导致了启动的时候报错,但是在属性文件中添加spring.session.store-type=none,启动不报错了,但是redis少了很多key值。所以后面还是加了一个类将@EnableRedisHttpSession(maxInactiveIntervalInSeconds =86400)以及@Configuration注解加上,这才没有报错。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容