Springboot2.2.2 jpa not automatically generates the table

Here springboot2.2.2 version uses no error occurred and no table is generated following question yml correct yml 

Class does not need to start adding @SpringBootApplication (exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) 

Hibernate packages do not need to import at pom file

Start class uses @SpringBootApplication

Entity class table must be added @Entity

 

Environmental idea2019.2 jdk1.8 mysql5.7

Project structure used here yml file  

 

 Here is the error yml  

 

 Yml jpa correct position to write correct yml Note hierarchy 

Recommended springboot jpa document   https://docs.spring.io/spring-data/jpa/docs/2.2.3.RELEASE/reference/html/#reference 

 

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/jpa?useSSL=true&serverTimezone=UTC&characterEncoding=UTF8
    data-username: root
    data-password: root
    #jpa配置  更新或自动生成表  控制台打印sql
  jpa:
    database: mysql
    show-sql: true
    hibernate:
      ddl-auto: update

重新run 启动类    出现创建表的语句 就成功了

Guess you like

Origin www.cnblogs.com/wf-zhang/p/12165991.html