首页 > 编程语言 > 详细

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

时间:2018-06-22 12:39:43      阅读:228      评论:0      收藏:0      [点我收藏+]

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默认国家化文件

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!