store is configured: set the ‘spring.session.store"/>
【解决】No Spring Session store is configured: set the ‘spring.session.store
Spring boot项目运行时报错:“No Spring Session store is configured: set the ‘spring.session.store-type’ property”
原因:session store type 是用来设置session的存放方式,现在Spring boot中只支持reids存储方式。
解决方案:
在application.yml或者application.properties中设置:
如果没有把session存入redis的需求,则设置如下:
application.yml:
spring:session:store-type: none
application.properties:
spring.session.store-type=none
如果需要把session存入redis,则设置如下:
application.yml:
spring:session:store-type: redis
application.properties:
spring.session.store-type=redis
这里如果按照以上写了,还是报错,还有一种原因是yml没读成功,比如文件名不是以application开头(正确应该是application-dev.yml),或者Run Configurations中的配置名字与yml中不一致。(项目右键 -> Run Configurations -> Java Application -> Arguments -> Program arguments: 比如dev写成其他了:例如 --spring.profiles.active=devKKK )
更多推荐
【解决】No Spring Session store is configured: set the ‘spring.session.store
发布评论