亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

連接數據庫報錯。該怎么處理?

按照課程配置。

<dependency>
? <groupId>org.springframework.boot</groupId>
? <artifactId>spring-boot-starter-data-jpa</artifactId>

</dependency>

? ? ?<dependency>
? ? ? ? ?<groupId>org.springframework.boot</groupId>
? ? ? ? ?<artifactId>spring-boot-starter-jdbc</artifactId>
? ? ?</dependency>

<dependency>
? <groupId>mysql</groupId>
? <artifactId>mysql-connector-java</artifactId>

</dependency>


spring:
profiles:
active: dev
datasource:
? ? ?driver-class-name: com.mysql.jdbc.Driver
? ? ?url: jdbc:mysql://localhost:3306/dbgirl
? ? ?username: ****
? ? ?password: ***
jpa:
? ? ?hibernate:
? ? ?ddl-auto: create
? ? ?show-sql: true

運行報錯。

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 (no profiles are currently active).


正在回答

3 回答

加上mysql依賴,

<dependency>
???<groupId>mysql</groupId>
???<artifactId>mysql-connector-java</artifactId>
</dependency>

如果用hibernate還有hibernate的依賴

<dependency>
???<groupId>org.hibernate</groupId>
???<artifactId>hibernate-core</artifactId>
</dependency>


0 回復 有任何疑惑可以回復我~

dependency沒有問題。

可能是配置的縮進格式問題。 我用git下載了課程的代碼。把配置文件重新拷貝了下就可以了。

0 回復 有任何疑惑可以回復我~

你還要檢察數據庫是否存在等一些問題

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
2小時學會Spring Boot
  • 參與學習       151526    人
  • 解答問題       1132    個

Spring Boot入門視頻教程,你將學會使用Spring Boot快速構建應用程序

進入課程

連接數據庫報錯。該怎么處理?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號