mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-02 15:29:05 +00:00
Polish "Take MethodType into account to deduce main application class"
See gh-31828
This commit is contained in:
+4
-4
@@ -285,10 +285,10 @@ public class SpringApplication {
|
||||
}
|
||||
|
||||
private Optional<Class<?>> findMainClass(Stream<StackFrame> stack) {
|
||||
return stack
|
||||
.filter((frame) -> Objects.equals(frame.getMethodName(), "main")
|
||||
&& Objects.equals(frame.getMethodType(), MethodType.methodType(void.class, String[].class)))
|
||||
.findFirst().map(StackWalker.StackFrame::getDeclaringClass);
|
||||
MethodType mainMethodType = MethodType.methodType(void.class, String[].class);
|
||||
return stack.filter((frame) -> Objects.equals(frame.getMethodName(), "main"))
|
||||
.filter((frame) -> Objects.equals(frame.getMethodType(), mainMethodType)).findFirst()
|
||||
.map(StackWalker.StackFrame::getDeclaringClass);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user