码迷,mamicode.com
首页 > 编程语言 > 详细

配置和修改springboot默认国家化文件

时间:2018-06-22 13:46:49      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:hello   path   base   doc   sage   har   pat   xmlns   ext   

SpringBoot默认国际化文件为:classpath:message.properties,如果放在其它文件夹中,则需要在application.properties配置属性spring.messages.basename:

在srpingboot自定义一个国家化文件:

1、在resources目录下创建myconfig.properties
2、修改application.properties或者application.yml文件:
        spring:
          messages:
            basename: myconfig


3、示例:
  myconfig.properties里加入:
message.hello="欢迎使用CRM系统!"

4、在resources的templates下新建index.html


<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<p th:text="#{message.hello}">This text will not be show! </p>

</body>
</html>

配置和修改springboot默认国家化文件

标签:hello   path   base   doc   sage   har   pat   xmlns   ext   

原文地址:https://www.cnblogs.com/asker009/p/9212649.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!