代码优化

This commit is contained in:
卢春梦 2024-09-12 11:23:33 +08:00
parent 10e7baa995
commit 7b0eb4104d

View File

@ -29,7 +29,6 @@ import org.springframework.lang.NonNull;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.util.*;
import java.util.stream.Collectors;
/**
* 设置启动参数
@ -74,7 +73,7 @@ public class BladeSpringExtension extends SpringExtension {
List<LauncherService> launcherList = new ArrayList<>();
SpringApplicationBuilder builder = new SpringApplicationBuilder(clazz);
ServiceLoader.load(LauncherService.class).forEach(launcherList::add);
launcherList.stream().sorted(Comparator.comparing(LauncherService::getOrder)).collect(Collectors.toList())
launcherList.stream().sorted(Comparator.comparing(LauncherService::getOrder)).toList()
.forEach(launcherService -> launcherService.launcher(builder, appName, profile));
}
System.err.printf("---[junit.test]:[%s]---启动中,读取到的环境变量:[%s]%n", appName, profile);