From 8f2544f1d0e5e82c0e7ee1d89abc1c916b0b9f9f Mon Sep 17 00:00:00 2001 From: yanghui <2536613402@qq.com> Date: 星期二, 01 十一月 2022 13:35:16 +0800 Subject: [PATCH] #feat 修改获取token --- springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/MessageUtils.java | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/MessageUtils.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/MessageUtils.java new file mode 100644 index 0000000..9e63c85 --- /dev/null +++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/MessageUtils.java @@ -0,0 +1,25 @@ +package com.panzhihua.common.utlis; + +import org.springframework.context.MessageSource; +import org.springframework.context.i18n.LocaleContextHolder; + +/** + * 获取i18n资源文件 + * + * @author ruoyi + */ +public class MessageUtils { + /** + * 根据消息键和参数 获取消息 委托给spring messageSource + * + * @param code + * 消息键 + * @param args + * 参数 + * @return 获取国际化翻译值 + */ + public static String message(String code, Object... args) { + MessageSource messageSource = SpringUtils.getBean(MessageSource.class); + return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); + } +} -- Gitblit v1.7.1