【问题标题】:No session repository could be auto-configured, check your configuration (session store type is 'null')无法自动配置会话存储库,请检查您的配置(会话存储类型为“空”)
【发布时间】:2016-11-06 18:32:03
【问题描述】:

这个spring boot启动错误是什么意思?

2016-07-04 21:53:53 [restartedMain] ERROR o.s.boot.SpringApplication - Application startup failed    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 session repository could be auto-configured, check your configuration (session store type is 'null')

【问题讨论】:

  • 我想知道为什么 intllij 项目默认情况下会出现这个问题,而另一个(说 tomcat 是在依赖项中提供的)顺便说一句我的问题现在已修复

标签: java spring session spring-boot repository


【解决方案1】:

您的类路径中有 Spring Session,但没有提供存储。我们无法为您做出该决定,因为您的类路径发生了变化,商店类型可能会根据我们的偏好发生变化,您会在没有任何警告的情况下丢失它们。

从历史上看,我们只支持 redis,所以如果你有,我们会透明地使用它。请将 spring.session.store-type 设置为您要用于 Spring Session 的商店。如果 Spring Session 在您的类路径中并且您现在不想使用它,请设置 spring.session.store-type=none

更新:鉴于赞成票的数量,这看起来像是一条令人困惑的错误消息,因此我打开了#9284 来改进它。

【讨论】:

  • 知道了。这是对 spring 会话最初操作方式的修改。 link。应用您的建议。
  • 只是一个补充:在你的 application.properties 中设置这个属性。
  • 为什么?您可以在 boot 所在的任何位置设置该属性。它可以是命令行开关、系统属性或其他任何东西。我同意你可能想在这种情况下把它放在那里。
  • 什么是商店类型?它是我们要使用的数据库名称吗?例如,如果我使用嵌入的 hsqldb、postgres 或作为 redis(我想我在 nosql db 列表中看到它的名称)等,我必须告诉它?以及它是什么,我们如何做到这一点?
  • 谢谢。或者,如果数据库已配置并准备就绪,则按照 docs.spring.io/spring-boot/docs/current/reference/html/… 将其设置为 jdbc。
猜你喜欢
  • 2020-12-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-07-10
  • 1970-01-01
  • 1970-01-01
  • 2014-11-04
  • 2014-09-13
相关资源
最近更新 更多