1.先看代碼:
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/db_user
username: root
password: root
jpa:
hibernate:
ddl-auto: create #ddl-auto:設(shè)為create表示每次都重新建表
show-sql: true
這個配置文件一個要在最前面加上spring:,不然的話會一直報錯,說你沒有編寫db配置文件,
報錯信息如下:
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).