一、關鍵配置spring
#初始化SQL initialization-mode: always schema: classpath:sql/schema.sql data: classpath:sql/data.sql sql-script-encoding: utf-8
jpa: database-platform: org.hibernate.dialect.MySQL5Dialect hibernate: ddl-auto: update show-sql: true generate-ddl: true
2.如下兩種狀況會致使啓動時sql腳本不執行:
A.啓動類上的註解若是配置了exclude={DataSourceAutoConfiguration.class},sql腳本將不被執行。sql
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
B.若是開啓了druid鏈接池的防火牆,sql腳本將不被執行。ui
spring datasource druid filter wall enabled: true