设置 Hibernate 方言不适用于 Spring 和 YML 配置

M U*_*M U 3 spring hibernate spring-boot

这是我的配置:

spring.jpa:
  hibernate:
    ddl-auto: update
    connection:
      charset: utf8
      useUnicode: true
  properties.hibernate.dialect: org.hibernate.dialect.MySQL5InnoDBDialect
Run Code Online (Sandbox Code Playgroud)

根据我在文档中发现的内容,因此它应该可以工作,但仍然使用 MyISAM 而不是 InnoDB 创建新表。

我的配置有什么问题?

Pär*_*son 7

设置方言的属性其实是 spring.jpa.properties.hibernate.dialect

尝试这个:

spring.jpa: 
  hibernate: 
    connection: 
      charset: utf8
      useUnicode: true
    ddl-auto: update
  properties.hibernate.dialect: org.hibernate.dialect.MySQL5InnoDBDialect
Run Code Online (Sandbox Code Playgroud)

Spring Boot 示例供参考