spring-boot - 我如何在 Spring Boot-1.4.1-RELEASE 中制作 i

我正在开发一个 spring boot 应用程序:

使用依赖:

    dependencies {
    compile("org.springframework.boot:spring-boot-starter-web:1.4.1.RELEASE")
    compile('org.springframework.boot:spring-boot-starter-data-jpa:1.4.1.RELEASE')
    compile('mysql:mysql-connector-java:5.1.39')
}

我想在 init 上运行 sql:

SET NAMES 'utf8mb4'

支持emoji读/写

我在 application.properties 上进行这些配置

spring.datasource.tomcat.init-sql=SET NAMES 'utf8mb4'
spring.datasource.init-sql=SET NAMES 'utf8mb4'
spring.datasource.connection-init-sql=SET NAMES 'utf8mb4'

但我无法让它工作,并且在应用程序启动时没有关于此的日志。

最佳答案

我想我找到了答案,根据这个answer :

正确的属性将是:

spring.datasource.tomcat.initSQL=SET NAMES 'utf8mb4'

然后这将在连接时执行。

关于spring-boot - 我如何在 Spring Boot-1.4.1-RELEASE 中制作 init-sql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40527477/

相关文章:

angular - 在 Angular2 中,您如何检测过滤器/管道未返回任何结果

javascript - 如何将 JSON/Bootstrap-Table 中的日期转换为 DD/M

SQL Server - 如果列包含值,则按 ID 分组

intellij-idea - 使用 Maven 项目创建测试类时,intellij 无法创建类文件

git - 我需要做一个 Git 克隆吗?

php - 使用干预将图像的 DPI 从 72 更改为 300

r - 使用 R 和 dplyr 扩展和离散化时间序列数据

php - 如何使用 laravel 5.2 获取 Blade 文件(HTML)中的最后一部分 ur

angular - 如何检测下拉列表元素的变化?

math - 围绕一个点旋转 Vector2