|
|
@ -17,7 +17,6 @@
|
|
|
|
package org.springframework.boot;
|
|
|
|
package org.springframework.boot;
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.StackWalker.StackFrame;
|
|
|
|
import java.lang.StackWalker.StackFrame;
|
|
|
|
import java.lang.invoke.MethodType;
|
|
|
|
|
|
|
|
import java.time.Duration;
|
|
|
|
import java.time.Duration;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
@ -166,7 +165,6 @@ import org.springframework.util.StringUtils;
|
|
|
|
* @author Brian Clozel
|
|
|
|
* @author Brian Clozel
|
|
|
|
* @author Ethan Rubinson
|
|
|
|
* @author Ethan Rubinson
|
|
|
|
* @author Chris Bono
|
|
|
|
* @author Chris Bono
|
|
|
|
* @author Yanming Zhou
|
|
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
* @since 1.0.0
|
|
|
|
* @see #run(Class, String[])
|
|
|
|
* @see #run(Class, String[])
|
|
|
|
* @see #run(Class[], String[])
|
|
|
|
* @see #run(Class[], String[])
|
|
|
@ -285,9 +283,7 @@ public class SpringApplication {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Optional<Class<?>> findMainClass(Stream<StackFrame> stack) {
|
|
|
|
private Optional<Class<?>> findMainClass(Stream<StackFrame> stack) {
|
|
|
|
MethodType mainMethodType = MethodType.methodType(void.class, String[].class);
|
|
|
|
return stack.filter((frame) -> Objects.equals(frame.getMethodName(), "main")).findFirst()
|
|
|
|
return stack.filter((frame) -> Objects.equals(frame.getMethodName(), "main"))
|
|
|
|
|
|
|
|
.filter((frame) -> Objects.equals(frame.getMethodType(), mainMethodType)).findFirst()
|
|
|
|
|
|
|
|
.map(StackWalker.StackFrame::getDeclaringClass);
|
|
|
|
.map(StackWalker.StackFrame::getDeclaringClass);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|