1. 程式人生 > >新建Spring boot 啟動報錯 Failed to auto-configure a DataSource

新建Spring boot 啟動報錯 Failed to auto-configure a DataSource

今天學習springboot,使用idea建立專案。在選擇元件時添加了mysq 然後在第一次啟動的時候啟動報錯,錯誤資訊如下:

***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.

If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

在多方查證後,需要在啟動類的@EnableAutoConfiguration或@SpringBootApplication中新增exclude

= {DataSourceAutoConfiguration.class},排除此類的autoconfig。啟動以後就可以正常執行。

這是因為添加了資料庫元件,所以autoconfig會去讀取資料來源配置,而我新建的專案還沒有配置資料來源,所以會導致異常出現。

解決問題方法2:不用改動新增語句,注意專案檔案結構的正確性

相關推薦

新建Spring boot 啟動 Failed to auto-configure a DataSource

今天學習springboot,使用idea建立專案。在選擇元件時添加了mysq 然後在第一次啟動的時候啟動報錯,錯誤資訊如下: ***************************APPLICATION FAILED TO START***************************Descriptio

Spring boot 啟動 Failed to auto-configure a DataSource

2018-03-29 22:09:30.459 INFO 10016 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2018-0

Spring boot2.0 啟動 Failed to auto-configure a DataSource

今天Spring Boot 2.0正式版釋出,尋思著搭個小demo嘗試一下Spring Boot的新特性,使用idea建立專案。在選擇元件時添加了mysql、mybatis 然後在第一次啟動的時候啟動報錯,錯誤資訊如下:APPLICATION FAILED TO STARTDescription:Failed

SpringBoot2 啟動 Failed to auto-configure a DataSource

控制檯列印輸出 *************************** APPLICATION FAILED TO START *************************** Description: Failed to configure a DataSource: 'url'

SpringBoot啟動Failed to auto-configure a DataSource 的問題解決!

今天搭了個springboot的小demo,但是啟動的時候報了這個錯誤: scription: Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no em

Spring Boot 啟動Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFa

在配置SpringBoot的時候 啟動的時候報錯 Unable to start ServletWebServerApplicationContext due to missing ServletWeb

SpringBoot啟動Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and

      今天倒騰了一下自己的SpringBoot demo的程式碼,發現啟動報瞭如下的錯誤: *************************** APPLICATION FAILED TO START *************************** Des

Failed to auto-configure a DataSource: 'spring.datasource.url' is not specif

開發十年,就只剩下這套架構體系了! >>>   

Spring boot 啟動-Reason Failed to determine a suitable driver class

啟動異常 *************************** APPLICATION FAILED TO START *************************** Description: Failed to configure a DataS

Spring boot 啟動:com.mongodb.MongoSocketOpenException: Exception opening socket

clas cati helper res connect ava bstr efault def   詳細錯誤信息: com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.

Spring Boot 啟動:LoggingFailureAnalysisReporter

char build starting zed load ring base resource enc 17:57:19: Executing task ‘bootRun‘... Parallel execution with configuration on dem

spring boot 啟動:Cannot determine embedded database driver class for database type NONE

info for bubuko 報錯 spring free 增加 .com control 錯誤原因:spring boot默認會加載org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfigurati

Spring Boot 啟動 Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 37

work 結果 frame getc director inf 中文 getclass post 使用命令 java -jar springBoot.jar 啟動項目,結果報錯如下: Exception in thread "main" java.lang.String

解決spring boot啟動java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level

blog nbsp java In idea AS level def sdn 解決spring boot啟動報錯java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level 學習了:https://blog.cs

Spring boot 啟動 'elasticsearchTemplate' that could not be found.

Spring boot 啟動報錯 (a)異常資訊 Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 201

轉:springboot專案啟動Failed to configure a DataSource: 'url' attribute is not specified and no embedde

*************************** APPLICATION FAILED TO START *************************** Description: Failed to configure a DataSource: 'url' attribute

Spring-Boot啟動java.lang.NoClassDefFoundError: ch/qos/logback/classic/turbo/TurboFilter

今天搭建專案的時候啟動報錯,java.lang.NoClassDefFoundError: ch/qos/logback/classic/turbo/TurboFilter 具體錯誤如下: 2018-09-15 16:06:14,588 main ERROR append

Eclipse中部署專案時,Tomcat啟動Failed to start component [StandardServer[8005]]”的解決方法

【錯誤現象】SEVERE: The required Server component failed to start so Tomcat is unable to start. org.apache.catalina.LifecycleException: F

Spring boot 啟動 'elasticsearchTemplate' that could not be found.

Spring boot 啟動報錯 (a)異常資訊 Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' e

轉:springboot專案啟動Failed to configure a DataSource: 'url' attribute is not specified and no embedde

*************************** APPLICATION FAILED TO START *************************** Description: Failed to configure a DataSource: 'url'