Set jpa utf-8 encoding in application.properties

前端 未结 2 1725
心在旅途
心在旅途 2020-12-22 01:24

This is a followup question to the following:

JPA utf-8 characters not persisted

The answer (https://stackoverflow.com/a/32574280) worked for me. However, I

相关标签:
2条回答
  • 2020-12-22 02:10

    if you are using spring boot, in application properties

    spring.datasource.connectionProperties=useUnicode=true;characterEncoding=utf-8;
    
    0 讨论(0)
  • 2020-12-22 02:19

    I stumbled into the same problem. Namely, I need to enable connection encryption by setting Oracle specific properties while using Tomcat Data Source and Spring Boot.

    Turns out the only way to do that with Spring Boot is to create a custom DataSource bean in the application configuration class.

    There is no way to pass custom connection properties to the pool, Spring Boot doesn't allow that. I checked Spring Boot 1.4.1 and the current master version of Spring Boot.

    If interested, take a look at DataSourceConfiguration.Tomcat class. The only properties it passes to the pool are the ones defined in DataSourceProperties class. The later doesn't have any fields allowing to pass custom properties, it supports only the predefined set of properties that are common for all datasources.

    0 讨论(0)
提交回复
热议问题