中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

使用Spring Boot時出現“be auto-configured, check ....”報錯如何解決

發布時間:2020-11-25 17:05:58 來源:億速云 閱讀:303 作者:Leah 欄目:編程語言

今天就跟大家聊聊有關使用Spring Boot時出現“be auto-configured, check ....”報錯如何解決,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。

Spring Boot報錯:No session repository could be auto-configured, check your configuration的解決方法,

一、環境介紹

JDK 1.8  spring-Boot 1.5.1.RELEASE, STS IDE

二、 問題的提出

創建了一個非常簡約的Spring Boot Web Application,其中使用了Spring-Session,具體的maven依賴如下:

 <dependency> 
<groupId>org.springframework.session</groupId> 
<artifactId>spring-session</artifactId> 
lt;/dependency> 

在啟動過程中,出現了如下錯誤信息:

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 
2017-02-23 17:48:10.710 ERROR 29484 --- [ restartedMain] 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') 
 at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:137) 
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409) 
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620) 
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) 
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) 
 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) 
 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) 
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) 
 at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) 
 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) 
 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) 
 at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) 
 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) 
 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) 
 at org.rosebird.data.stock.StockdataApplication.main(StockdataApplication.java:10) 
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
 at java.lang.reflect.Method.invoke(Method.java:497) 
 at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) 
Caused by: java.lang.IllegalArgumentException: No session repository could be auto-configured, check your configuration (session store type is 'null') 
 at org.springframework.util.Assert.notNull(Assert.java:115) 
 at org.springframework.boot.autoconfigure.session.SessionAutoConfiguration$SessionRepositoryValidator.checkSessionRepository(SessionAutoConfiguration.java:100) 
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
 at java.lang.reflect.Method.invoke(Method.java:497) 
 at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:366) 
 at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:311) 
 at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:134) 
 ... 23 common frames omitted 

異常棧很長,關鍵的錯誤信息是:No session repository could be auto-configured, check your configuration (session store type is 'null') ,這個信息對于我們進行問題分析提供了非常大的指引, 我們將重點放在session store type的功能分析上。

三、問題的解決與分析

 在網上搜索之后,我們發現session store type使用來存放session的存儲方式,目前Spring boot中只支持Redis方式。 由于本應用暫無需將session放入redis的需求,故這里就可以將session store type設置為none.

這里我們將此配置信息放入application.properites之中:

# default-store in spring session. it will be set in redis only outside. 
spring.session.store-type=none 

重新啟動應用,錯誤信息消失, 我們可以看到了啟動正常的信息了:

2017-02-23 19:36:17.437 INFO 10500 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain  : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/css/**'], Ant [pattern='/js/**'], Ant [pattern='/images/**'], Ant [pattern='/webjars/**'], Ant [pattern='/**/favicon.ico'], Ant [pattern='/error']]], [] 
2017-02-23 19:36:17.823 INFO 10500 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain  : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/**']]], [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@6c7bc3c3, org.springframework.security.web.context.SecurityContextPersistenceFilter@7e251380, org.springframework.security.web.header.HeaderWriterFilter@d2c9b20, org.springframework.security.web.authentication.logout.LogoutFilter@32d5aa81, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@57b802cf, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6a11f15, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@510cb143, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@69e3d43f, org.springframework.security.web.session.SessionManagementFilter@182c322e, org.springframework.security.web.access.ExceptionTranslationFilter@72545397, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@7c8a6e92] 
2017-02-23 19:36:18.163 INFO 10500 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer  : LiveReload server is running on port 35729 
2017-02-23 19:36:18.346 INFO 10500 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter  : Registering beans for JMX exposure on startup 
2017-02-23 19:36:18.570 INFO 10500 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 
2017-02-23 19:36:18.588 INFO 10500 --- [ restartedMain] o.r.data.stock.StockdataApplication  : Started StockdataApplication in 25.393 seconds (JVM running for 27.444) 

看完上述內容,你們對使用Spring Boot時出現“be auto-configured, check ....”報錯如何解決有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

大理市| 清原| 沅陵县| 和田县| 宝丰县| 长治县| 西畴县| 清流县| 留坝县| 宝山区| 疏附县| 静海县| 武隆县| 宜兰市| 沧州市| 定襄县| 宣城市| 山东省| 曲阜市| 香格里拉县| 永嘉县| 卓资县| 广西| 石景山区| 高碑店市| 介休市| 康乐县| 南岸区| 胶州市| 蛟河市| 噶尔县| 九龙坡区| 汝州市| 城口县| 苏尼特右旗| 新竹市| 炎陵县| 息烽县| 正镶白旗| 永顺县| 麻栗坡县|