From 09003998cf8c6cb29668b37b7e3caad4a2ce9f67 Mon Sep 17 00:00:00 2001 From: Hccake Date: Tue, 7 May 2024 22:23:35 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20(i18n)=20=E4=BF=AE=E5=A4=8D=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=20resource=20bundle=20=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E5=8A=A0=E8=BD=BD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i18n/WildcardReloadableResourceBundleMessageSource.java | 2 +- .../java/org/ballcat/i18n/HierarchicalMessageSourceTest.java | 2 +- .../i18n/WildcardReloadableResourceBundleMessageSourceTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/i18n/ballcat-i18n/src/main/java/org/ballcat/i18n/WildcardReloadableResourceBundleMessageSource.java b/i18n/ballcat-i18n/src/main/java/org/ballcat/i18n/WildcardReloadableResourceBundleMessageSource.java index 8e22e60b8..b4cb3cc61 100644 --- a/i18n/ballcat-i18n/src/main/java/org/ballcat/i18n/WildcardReloadableResourceBundleMessageSource.java +++ b/i18n/ballcat-i18n/src/main/java/org/ballcat/i18n/WildcardReloadableResourceBundleMessageSource.java @@ -114,7 +114,7 @@ protected List calculateFilenamesForLocale(String basename, Locale local private Resource[] getResources(String resourceLocationPattern) throws IOException { // 支持用 . 表示文件层级 resourceLocationPattern = resourceLocationPattern.replace(".", "/"); - return this.resolver.getResources(resourceLocationPattern + PROPERTIES_SUFFIX); + return this.resolver.getResources("classpath*:" + resourceLocationPattern + PROPERTIES_SUFFIX); } private boolean containsWildcard(String str) { diff --git a/i18n/ballcat-i18n/src/test/java/org/ballcat/i18n/HierarchicalMessageSourceTest.java b/i18n/ballcat-i18n/src/test/java/org/ballcat/i18n/HierarchicalMessageSourceTest.java index 1ea4eb38e..4418786d5 100644 --- a/i18n/ballcat-i18n/src/test/java/org/ballcat/i18n/HierarchicalMessageSourceTest.java +++ b/i18n/ballcat-i18n/src/test/java/org/ballcat/i18n/HierarchicalMessageSourceTest.java @@ -29,7 +29,7 @@ class HierarchicalMessageSourceTest { MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource = new WildcardReloadableResourceBundleMessageSource(); // Specify the location of the properties file - messageSource.setBasename("classpath:test-*"); + messageSource.setBasename("test-*"); messageSource.setDefaultEncoding("UTF-8"); messageSource.setFallbackToSystemLocale(false); diff --git a/i18n/ballcat-i18n/src/test/java/org/ballcat/i18n/WildcardReloadableResourceBundleMessageSourceTest.java b/i18n/ballcat-i18n/src/test/java/org/ballcat/i18n/WildcardReloadableResourceBundleMessageSourceTest.java index b5e501168..cf9c325e6 100644 --- a/i18n/ballcat-i18n/src/test/java/org/ballcat/i18n/WildcardReloadableResourceBundleMessageSourceTest.java +++ b/i18n/ballcat-i18n/src/test/java/org/ballcat/i18n/WildcardReloadableResourceBundleMessageSourceTest.java @@ -30,7 +30,7 @@ ReloadableResourceBundleMessageSource messageSource(boolean fallbackToSystemLoca ReloadableResourceBundleMessageSource messageSource = new WildcardReloadableResourceBundleMessageSource(); // Specify the location of the properties file - messageSource.setBasename("classpath*:org.ballcat.**.messages"); + messageSource.setBasename("org.ballcat.**.messages"); messageSource.setDefaultEncoding("UTF-8"); messageSource.setFallbackToSystemLocale(fallbackToSystemLocale); return messageSource;