SpringBoot +JPA里面的坑

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:设为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).

你可能感兴趣的:(SpringBoot +JPA里面的坑)