From 443ee7188dd6e6f2be2bb1416a248031fd4316bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=A2=A6=E6=8A=80=E6=9C=AF?= <596392912@qq.com> Date: Thu, 26 Sep 2024 13:50:33 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../launch/props/BladePropertySourcePostProcessor.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/props/BladePropertySourcePostProcessor.java b/blade-core-launch/src/main/java/org/springblade/core/launch/props/BladePropertySourcePostProcessor.java index b85213b..b762f0b 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/props/BladePropertySourcePostProcessor.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/props/BladePropertySourcePostProcessor.java @@ -39,7 +39,6 @@ import org.springframework.util.StringUtils; import java.io.IOException; import java.util.*; -import java.util.stream.Collectors; /** * 自定义资源文件读取,优先级最低 @@ -92,13 +91,13 @@ public class BladePropertySourcePostProcessor implements BeanFactoryPostProcesso List sortedPropertyList = propertyFileList.stream() .distinct() .sorted() - .collect(Collectors.toList()); + .toList(); ConfigurableEnvironment environment = beanFactory.getBean(ConfigurableEnvironment.class); MutablePropertySources propertySources = environment.getPropertySources(); // 只支持 activeProfiles,没有必要支持 spring.profiles.include。 String[] activeProfiles = environment.getActiveProfiles(); - ArrayList propertySourceList = new ArrayList<>(); + List propertySourceList = new ArrayList<>(); for (String profile : activeProfiles) { for (PropertyFile propertyFile : sortedPropertyList) { // 不加载 ActiveProfile 的配置文件 @@ -112,7 +111,7 @@ public class BladePropertySourcePostProcessor implements BeanFactoryPostProcesso } String location = propertyFile.getLocation(); String filePath = StringUtils.stripFilenameExtension(location); - String profiledLocation = filePath + "-" + profile + "." + extension; + String profiledLocation = filePath + '-' + profile + '.' + extension; Resource resource = resourceLoader.getResource(profiledLocation); loadPropertySource(profiledLocation, resource, loader, propertySourceList); } @@ -135,7 +134,7 @@ public class BladePropertySourcePostProcessor implements BeanFactoryPostProcesso PropertySourceLoader loader, List sourceList) { if (resource.exists()) { - String name = "bladePropertySource: [" + location + "]"; + String name = "bladePropertySource: [" + location + ']'; try { sourceList.addAll(loader.load(name, resource)); } catch (IOException e) {