我在Spring Boot上有一个问题。 Spring Boot启动的最后一步,即返回之前。遇到断点。
public ConfigurableApplicationContext run(String... args) {
StopWatch stopWatch = new StopWatch();
.......
return context; // here is breakpoint
}
在该想法的控制台中,输出以下信息。
2019-11-07 01:26:32.444 INFO 74693 --- [ main] com.xxxx.me.hello.HelloApplication : Starting HelloApplication on xxxxMBP.lan with PID 74693 (/Users/dukeyu/Projects/hello/target/classes started by xxxx in /Users/xxxx/Projects/hello)
2019-11-07 01:26:32.451 INFO 74693 --- [ main] com.xxxx.me.hello.HelloApplication : No active profile set,falling back to default profiles: default
2019-11-07 01:26:37.018 INFO 74693 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-11-07 01:26:37.043 INFO 74693 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-11-07 01:26:37.043 INFO 74693 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.24]
2019-11-07 01:26:37.226 INFO 74693 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-11-07 01:26:37.227 INFO 74693 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4650 ms
2019-11-07 01:26:37.520 INFO 74693 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-07 01:26:38.672 INFO 74693 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-07 01:26:38.677 INFO 74693 --- [ main] com.xxxxx.me.hello.HelloApplication : Started HelloApplication in 6.94 seconds (JVM running for 8.283)
我认为tomcat已经启动,应该可以接受请求了。 但是实际上在Chrome中发送请求已被阻止。 如果未达到此断点,则运行方法返回后,发送的请求将响应。 打扰一下,执行main方法后还有其他行为影响吗?