Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 would like to save those configurations in my application.properties file separate from the url configuration. What would be the name of those configurations?

I've tried:

connection.useUnicode=true connection.characterEncoding=utf8

And then I set them in my Properties in my Configuration class:

properties.put("connection.useUnicode", env.getRequiredProperty("connection.useUnicode")); properties.put("connection.characterEncoding", env.getRequiredProperty("connection.characterEncoding"));

But it isn't working.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.5k views
Welcome To Ask or Share your Answers For Others

1 Answer

if you are using spring boot, in application properties

spring.datasource.connectionProperties=useUnicode=true;characterEncoding=utf-8;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...