International SpringBoot garbled solve engineering


Garbled display: ?? login.tip_zh_CN ??, ?? login.choice_zh_CN ?? and other needs of the international content

1. First check the internationalization files (.properties) is whether it is UTF-8 encoded
2.MessageSourceAutoConfiguration automatically configured the component manages an international resource files, the default configuration file name international prefix messages, configuration files can be placed directly in the classpath, the file is called messages.properties

Internationalization file storage path: classpath: messages * .properties

 After the inspection visit again:

 

 

If, in the custom resources folder to store international documents in the global document springboot properly configured path

Under 1.resources folder, custom folder where you saved the i18n internationalization files

2. The need for international configured in the application.properties

# Internationalization configuration
spring.messages.encoding=UTF-8
= spring.messages.basename i18n.login    
# or
spring.messages.basename = i18n / login path must correspond to good

 access:

 

Guess you like

Origin www.cnblogs.com/youngyajun/p/11689763.html