没有会话存储库可以自动配置,检查您的配置(会话存储类型为'null')

000*_*000 31 java session spring repository 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')
Run Code Online (Sandbox Code Playgroud)

Ste*_*oll 68

你的类路径上有Spring Session,没有提供商店.我们不能为您做出这样的决定,就好像您的类路径发生变化一样,商店类型可能会根据我们的偏好而改变,而您会在没有任何警告的情况下丢失它们.

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

更新:鉴于upvotes的数量,这看起来像一个令人困惑的错误消息,所以我打开#9284来改进它.

  • 只需添加:在application.properties中设置此属性. (10认同)