springboot項目報錯mysql
Cannot determine embedded database driver class for database type NONEredis
具體以下:spring
*************************** APPLICATION FAILED TO START *************************** Description: Cannot determine embedded database driver class for database type NONE Action: If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (the profiles "dev" are currently active).
其中,相關yml文件以下:sql
spring: redis: host: localhost password: port: 6379 timeout: 1000 pool: max-idle: 100 # 鏈接池中的最大空閒鏈接 min-idle: 1 # 鏈接池中的最小空閒鏈接 max-active: 1000 #鏈接池最大鏈接數(使用負值表示沒有限制) max-wait: -1 # 鏈接池最大阻塞等待時間(使用負值表示沒有限制)
這裏沒有配置mysql的連接,是由於該項目不須要與mysql進行交互。apache
springboot 要建立一個DataSource對象:tomcat
嘗試查找dataSourceClass,若是找到,條件就成立。那麼debug下,能夠發現查找到的dataSourceClass是:org.apache.tomcat.jdbc.pool.DataSource 。springboot
那麼再看下org.apache.tomcat.jdbc.pool.DataSource這個類是從哪裏來的呢?mybatis
從maven依賴樹能夠看到,依賴是來自:spring-boot-starter-jdbc。因此是應用依賴了spring-boot-starter-jdbc,可是並無配置DataSource引發的問題。maven
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency>
pom中刪除以下依賴(由於該依賴向上依賴了spring-boot-starter-jdbc
)spring-boot
<dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.1.1</version> </dependency>