In my example above I had spring.boot.starter.web on the classpath and the app failed to start. If I add org.apache.tomcat.embed.core then the application starts successfully.

When I configured module-info.java this way

requires spring.boot;
requires spring.boot.autoconfigure;
requires spring.web;
requires spring.boot.starter.web;
2021-05-20 10:56:09.501  INFO 17112 --- [           main] com.example.police.PoliceApplication     : Starting PoliceApplication using Java 11 on zhaozhiguang-pc with PID 17112 (D:\item\police\target\classes started by zhaozhiguang in D:\item\police)
2021-05-20 10:56:09.501  INFO 17112 --- [           main] com.example.police.PoliceApplication     : No active profile set, falling back to default profiles: default
2021-05-20 10:56:10.565  INFO 17112 --- [           main] com.example.police.PoliceApplication     : Started PoliceApplication in 1.435 seconds (JVM running for 3.153)

Process finished with exit code 0

My guess is that Tomcat didn't boot

or

requires spring.boot;
requires spring.boot.autoconfigure;
requires spring.web;
requires org.apache.tomcat.embed.core;

This one worked

2021-05-20 10:57:48.097  INFO 13740 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-05-20 10:57:48.334  INFO 13740 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-05-20 10:57:48.381  INFO 13740 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-05-20 10:57:48.396  INFO 13740 --- [           main] com.example.police.PoliceApplication     : Started PoliceApplication in 2.001 seconds (JVM running for 3.202)
2021-05-20 10:57:48.846  INFO 13740 --- [)-192.168.1.107] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-05-20 10:57:48.846  INFO 13740 --- [)-192.168.1.107] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2021-05-20 10:57:48.847  INFO 13740 --- [)-192.168.1.107] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms

why?

spring.boot.starter.web depend on org.apache.tomcat.embed.core ?

Comment From: philwebb

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.