【解决】No Spring Session store is configured: set the ‘spring.session.store

编程入门 行业动态 更新时间:2024-10-09 10:31:14

【解决】No Spring Session <a href=https://www.elefans.com/category/jswz/34/1762586.html style=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

本文发布于:2024-02-13 14:51:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1759100.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:store   Session   Spring   configured   session

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!