为什么 Spring Boot Web 应用程序启动后立即关闭?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24214224/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 06:46:53  来源:igfitidea点击:

Why does Spring Boot web app close immediately after starting?

springspring-boot

提问by Paul Drummond

Using STS, if I import the "Rest Service"Getting Started project using the latest Spring Boot and choose "Run As Spring Boot App", it starts up, then immediately shuts down.

使用 STS,如果我"Rest Service"使用最新的 Spring Boot导入Getting Started 项目并选择"Run As Spring Boot App",它会启动,然后立即关闭。

Looking at the debug logs, Spring is for some reason deciding the project is not a web application, but I have no idea why.

查看调试日志,Spring 出于某种原因决定该项目不是 Web 应用程序,但我不知道为什么。

If I switch from Spring Boot 1.1.1.RELEASEto 1.0.1.RELEASE, the project works as expected and the default Tomcat embedded server is found.

如果我从 Spring Boot 切换1.1.1.RELEASE1.0.1.RELEASE,该项目将按预期工作,并找到默认的 Tomcat 嵌入式服务器。

I can't find anything in the 1.1.1release notes that suggests there is a config change or anything?

我在1.1.1发行说明中找不到任何表明配置更改或任何内容的内容?

UPDATE: Steps to reproduce and log output

更新:重现和记录输出的步骤

I'm running STS 3.6.0.M1 and Spring 4.0.5 and Spring Boot 1.1.1. I can easily reproduce this by doing the following:

我正在运行 STS 3.6.0.M1 和 Spring 4.0.5 以及 Spring Boot 1.1.1。我可以通过执行以下操作轻松重现这一点:

  1. Import the REST Service Getting started app.
  2. Select "Run as Spring Boot Project"
  3. This is the output:

    :: Spring Boot ::        (v1.1.1.RELEASE)
    
    2014-06-14 11:08:34.226  INFO 47728 --- [           main] hello.Application                        : Starting Application on localhost with PID 47728 (/Users/pdrummond/src/sts/gs-rest-service-complete/target/classes started by pdrummond in /Users/pdrummond/src/sts/gs-rest-service-complete)
    2014-06-14 11:08:34.257  INFO 47728 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@802b249: startup date [Sat Jun 14 11:08:34 BST 2014]; root of context hierarchy
    2014-06-14 11:08:34.680  INFO 47728 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
    2014-06-14 11:08:34.908  INFO 47728 --- [           main] hello.Application                        : Started Application in 0.917 seconds (JVM running for 1.351)
    2014-06-14 11:08:36.397  INFO 47728 --- [       Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@802b249: startup date [Sat Jun 14 11:08:34 BST 2014]; root of context hierarchy
    2014-06-14 11:08:36.398  INFO 47728 --- [       Thread-3] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
    
  4. If I edit the pom and change the spring-boot-starter-parentto 1.0.1.RELEASEit boots as expected.

  1. 导入 REST 服务入门应用程序。
  2. 选择“作为 Spring Boot 项目运行”
  3. 这是输出:

    :: Spring Boot ::        (v1.1.1.RELEASE)
    
    2014-06-14 11:08:34.226  INFO 47728 --- [           main] hello.Application                        : Starting Application on localhost with PID 47728 (/Users/pdrummond/src/sts/gs-rest-service-complete/target/classes started by pdrummond in /Users/pdrummond/src/sts/gs-rest-service-complete)
    2014-06-14 11:08:34.257  INFO 47728 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@802b249: startup date [Sat Jun 14 11:08:34 BST 2014]; root of context hierarchy
    2014-06-14 11:08:34.680  INFO 47728 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
    2014-06-14 11:08:34.908  INFO 47728 --- [           main] hello.Application                        : Started Application in 0.917 seconds (JVM running for 1.351)
    2014-06-14 11:08:36.397  INFO 47728 --- [       Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@802b249: startup date [Sat Jun 14 11:08:34 BST 2014]; root of context hierarchy
    2014-06-14 11:08:36.398  INFO 47728 --- [       Thread-3] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
    
  4. 如果我编辑的POM并更改spring-boot-starter-parent1.0.1.RELEASE它的靴子如预期。

UPDATE 2: Added output from --debug command

更新 2:添加了 --debug 命令的输出

     :: Spring Boot ::        (v1.1.1.RELEASE)

    2014-06-14 19:29:03.814  INFO 986 --- [           main] hello.Application                        : Starting Application on localhost with PID 986 (/Users/pdrummond/src/sts/gs-rest-service-complete/target/classes started by pdrummond in /Users/pdrummond/src/sts/gs-rest-service-complete)
    2014-06-14 19:29:03.816 DEBUG 986 --- [           main] o.s.boot.SpringApplication               : Loading source class hello.Application
    2014-06-14 19:29:03.838  INFO 986 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@c163956: startup date [Sat Jun 14 19:29:03 BST 2014]; root of context hierarchy
    2014-06-14 19:29:04.177  INFO 986 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
    2014-06-14 19:29:04.346 DEBUG 986 --- [           main] utoConfigurationReportLoggingInitializer : 


    =========================
    AUTO-CONFIGURATION REPORT
    =========================


    Positive matches:
    -----------------

       PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer
          - @ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) found no beans (OnBeanCondition)

       HymansonAutoConfiguration
          - @ConditionalOnClass classes found: com.fasterxml.Hymanson.databind.ObjectMapper (OnClassCondition)

       HymansonAutoConfiguration#HymansonObjectMapper
          - @ConditionalOnMissingBean (types: com.fasterxml.Hymanson.databind.ObjectMapper; SearchStrategy: all) found no beans (OnBeanCondition)

       JmxAutoConfiguration
          - @ConditionalOnClass classes found: org.springframework.jmx.export.MBeanExporter (OnClassCondition)
          - SpEL expression on org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration: ${spring.jmx.enabled:true} (OnExpressionCondition)

       JmxAutoConfiguration#mbeanServer
          - @ConditionalOnMissingBean (types: javax.management.MBeanServer; SearchStrategy: all) found no beans (OnBeanCondition)

       JmxAutoConfiguration#objectNamingStrategy
          - @ConditionalOnMissingBean (types: org.springframework.jmx.export.naming.ObjectNamingStrategy; SearchStrategy: all) found no beans (OnBeanCondition)

       HttpMessageConvertersAutoConfiguration
          - @ConditionalOnClass classes found: org.springframework.http.converter.HttpMessageConverter (OnClassCondition)

       HttpMessageConvertersAutoConfiguration#messageConverters
          - @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.web.HttpMessageConverters; SearchStrategy: all) found no beans (OnBeanCondition)

       HttpMessageConvertersAutoConfiguration.ObjectMappers
          - @ConditionalOnClass classes found: com.fasterxml.Hymanson.databind.ObjectMapper (OnClassCondition)

       HttpMessageConvertersAutoConfiguration.ObjectMappers#mappingHymanson2HttpMessageConverter
          - @ConditionalOnMissingBean (types: org.springframework.http.converter.json.MappingHymanson2HttpMessageConverter; SearchStrategy: all) found no beans (OnBeanCondition)


    Negative matches:
    -----------------

       MessageSourceAutoConfiguration
          - Bundle found for spring.messages.basename: messages (MessageSourceAutoConfiguration.ResourceBundleCondition)

       RabbitAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.amqp.rabbit.core.RabbitTemplate,com.rabbitmq.client.Channel (OnClassCondition)

       AopAutoConfiguration
          - required @ConditionalOnClass classes not found: org.aspectj.lang.annotation.Aspect,org.aspectj.lang.reflect.Advice (OnClassCondition)

       BatchAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.batch.core.launch.JobLauncher,org.springframework.jdbc.core.JdbcOperations (OnClassCondition)

       ElasticsearchRepositoriesAutoConfiguration
          - required @ConditionalOnClass classes not found: org.elasticsearch.client.Client,org.springframework.data.elasticsearch.repository.ElasticsearchRepository (OnClassCondition)

       JpaRepositoriesAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.data.jpa.repository.JpaRepository (OnClassCondition)

       MongoRepositoriesAutoConfiguration
          - required @ConditionalOnClass classes not found: com.mongodb.Mongo,org.springframework.data.mongodb.repository.MongoRepository (OnClassCondition)

       RepositoryRestMvcAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       SolrRepositoriesAutoConfiguration
          - required @ConditionalOnClass classes not found: org.apache.solr.client.solrj.SolrServer,org.springframework.data.solr.repository.SolrRepository (OnClassCondition)

       ElasticsearchAutoConfiguration
          - required @ConditionalOnClass classes not found: org.elasticsearch.client.Client,org.springframework.data.elasticsearch.client.TransportClientFactoryBean,org.springframework.data.elasticsearch.client.NodeClientFactoryBean (OnClassCondition)

       ElasticsearchDataAutoConfiguration
          - required @ConditionalOnClass classes not found: org.elasticsearch.client.Client,org.springframework.data.elasticsearch.core.ElasticsearchTemplate (OnClassCondition)

       FlywayAutoConfiguration
          - required @ConditionalOnClass classes not found: org.flywaydb.core.Flyway (OnClassCondition)

       FreeMarkerAutoConfiguration
          - required @ConditionalOnClass classes not found: freemarker.template.Configuration,org.springframework.ui.freemarker.FreeMarkerConfigurationFactory (OnClassCondition)

       GroovyTemplateAutoConfiguration
          - required @ConditionalOnClass classes not found: groovy.text.TemplateEngine (OnClassCondition)

       HypermediaAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.hateoas.Resource (OnClassCondition)

       IntegrationAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.integration.config.EnableIntegration (OnClassCondition)

       HymansonAutoConfiguration.JodaModuleAutoConfiguration
          - required @ConditionalOnClass classes not found: com.fasterxml.Hymanson.datatype.joda.JodaModule (OnClassCondition)

       HymansonAutoConfiguration.Jsr310ModuleAutoConfiguration
          - Required JVM version 1.8 or newer found 1.6 (OnJavaCondition)

       DataSourceAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType (OnClassCondition)

       DataSourceTransactionManagerAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.jdbc.core.JdbcTemplate,org.springframework.transaction.PlatformTransactionManager (OnClassCondition)

       JmsAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.jms.core.JmsTemplate (OnClassCondition)

       ActiveMQAutoConfiguration
          - required @ConditionalOnClass classes not found: javax.jms.ConnectionFactory,org.apache.activemq.ActiveMQConnectionFactory (OnClassCondition)

       HornetQAutoConfiguration
          - required @ConditionalOnClass classes not found: javax.jms.ConnectionFactory,org.hornetq.api.jms.HornetQJMSClient (OnClassCondition)

       JmxAutoConfiguration#mbeanExporter
          - @ConditionalOnMissingBean (types: org.springframework.jmx.export.MBeanExporter; SearchStrategy: current) found the following [mbeanExporter] (OnBeanCondition)

       LiquibaseAutoConfiguration
          - required @ConditionalOnClass classes not found: liquibase.integration.spring.SpringLiquibase (OnClassCondition)

       DeviceDelegatingViewResolverAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       DeviceResolverAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.mobile.device.DeviceResolverHandlerInterceptor,org.springframework.mobile.device.DeviceHandlerMethodArgumentResolver (OnClassCondition)

       SitePreferenceAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.mobile.device.site.SitePreferenceHandlerInterceptor,org.springframework.mobile.device.site.SitePreferenceHandlerMethodArgumentResolver (OnClassCondition)

       MongoAutoConfiguration
          - required @ConditionalOnClass classes not found: com.mongodb.Mongo (OnClassCondition)

       MongoDataAutoConfiguration
          - required @ConditionalOnClass classes not found: com.mongodb.Mongo,org.springframework.data.mongodb.core.MongoTemplate (OnClassCondition)

       HibernateJpaAutoConfiguration
          - did not find HibernateEntityManager class (HibernateJpaAutoConfiguration.HibernateEntityManagerCondition)

       ReactorAutoConfiguration
          - required @ConditionalOnClass classes not found: reactor.spring.context.config.EnableReactor (OnClassCondition)

       RedisAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.data.redis.connection.jedis.JedisConnection,org.springframework.data.redis.core.RedisOperations,redis.clients.jedis.Jedis (OnClassCondition)

       FallbackWebSecurityAutoConfiguration
          - SpEL expression on org.springframework.boot.autoconfigure.security.FallbackWebSecurityAutoConfiguration: !${security.basic.enabled:true} (OnExpressionCondition)

       SecurityAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.security.authentication.AuthenticationManager (OnClassCondition)

       FacebookAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.social.facebook.connect.FacebookConnectionFactory (OnClassCondition)

       LinkedInAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.social.linkedin.connect.LinkedInConnectionFactory (OnClassCondition)

       SocialWebAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.social.connect.web.ConnectController,org.springframework.social.config.annotation.SocialConfigurerAdapter (OnClassCondition)

       TwitterAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.social.twitter.connect.TwitterConnectionFactory (OnClassCondition)

       SolrAutoConfiguration
          - required @ConditionalOnClass classes not found: org.apache.solr.client.solrj.SolrServer (OnClassCondition)

       ThymeleafAutoConfiguration
          - required @ConditionalOnClass classes not found: org.thymeleaf.spring4.SpringTemplateEngine (OnClassCondition)

       VelocityAutoConfiguration
          - required @ConditionalOnClass classes not found: org.apache.velocity.app.VelocityEngine,org.springframework.ui.velocity.VelocityEngineFactory (OnClassCondition)

       DispatcherServletAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       EmbeddedServletContainerAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       ErrorMvcAutoConfiguration
          - required @ConditionalOnClass classes not found: javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet (OnClassCondition)

       MultipartAutoConfiguration
          - required @ConditionalOnClass classes not found: javax.servlet.Servlet,javax.servlet.MultipartConfigElement (OnClassCondition)

       ServerPropertiesAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       WebMvcAutoConfiguration
          - not a web application (OnWebApplicationCondition)

       WebSocketAutoConfiguration
          - required @ConditionalOnClass classes not found: javax.servlet.Servlet,org.apache.catalina.startup.Tomcat,org.springframework.web.socket.WebSocketHandler,org.apache.tomcat.websocket.server.WsSci (OnClassCondition)



    2014-06-14 19:29:04.348  INFO 986 --- [           main] hello.Application                        : Started Application in 0.73 seconds (JVM running for 1.085)
    2014-06-14 19:29:06.378  INFO 986 --- [       Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@c163956: startup date [Sat Jun 14 19:29:03 BST 2014]; root of context hierarchy
    2014-06-14 19:29:06.379  INFO 986 --- [       Thread-3] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

回答by bigMC28

I had this same issue. To make it work I had to adjust the pom.xml and comment-out the 'provided' scope for spring-boot-starter-tomcat artifact and update the dependencies.

我有同样的问题。为了使它工作,我必须调整 pom.xml 并注释掉 spring-boot-starter-tomcat 工件的“提供”范围并更新依赖项。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <!--<scope>provided</scope>-->
</dependency>

Now it starts up as expected! Thanks to some of the other answers that put me on the right track.

现在它按预期启动了!感谢其他一些让我走上正轨的答案。

回答by Boreas320

Check the mvn log when you execute package phase ,and make sure that the tomcat-embed-core jar is assigned into you app jar.

执行包阶段时检查 mvn 日志,并确保将 tomcat-embed-core jar 分配到您的应用程序 jar 中。

回答by Chaithu Narayana

I had the same issue where my spring-boot app shuts down immediately without any trace of tomcat being started up although I had the dependency <artifactId>spring-boot-starter-web</artifactId>included in my pom.xml. This indicates that spring-boot isn't recognizing my app as a web application.

我遇到了同样的问题,尽管我的<artifactId>spring-boot-starter-web</artifactId>pom.xml 中包含了依赖项,但我的 spring-boot 应用程序立即关闭,但没有任何 tomcat 启动的痕迹。这表明 spring-boot 没有将我的应用程序识别为 Web 应用程序。

Tried cleaning up and packaging my app again using mvn clean installutilities to verify if tomcat libraries are getting packaged into my app binary/deployable. Found the following issue (look for line starting with '[WARNING]'):

尝试使用mvn clean install实用程序再次清理和打包我的应用程序,以验证 tomcat 库是否被打包到我的应用程序二进制/可部署中。发现以下问题(查找以“[WARNING]”开头的行):

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ exam-launcher ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\XXXXX\XXXXXX\XXXX_Workspace\my-app\target\classes
[WARNING] error reading c:\.m2\org\apache\tomcat\embed\tomcat-embed-core.5.14\tomcat-embed-core-8.5.14.jar; invalid LOC header (bad signature)
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ exam-launcher ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Chaithu\Work_Related\Eclipse_Neon_Workspace\exam-portal-server\src\test\resources

The tomcat library I had on my local repo got corrupted (for some unknown reasons) because of which it wasn't getting included in the maven package. Deleted the corresponding folder from my local maven repo and let maven download it freshly. And it works like a charm now !!

我在本地存储库中的 tomcat 库已损坏(出于某些未知原因),因此它没有包含在 maven 包中。从我的本地 maven repo 中删除了相应的文件夹,让 maven 重新下载它。它现在就像一个魅力!

回答by Arundev

Just add

只需添加

 spring.main.web-environment=true

in application.properties and restart.

在 application.properties 中并重新启动。

回答by sarmahdi

All the answers suggested that tomcat is missing from it. in my case it was tagged in my pom with <scope>provided</scope>which I think i did it as i would need to run my application on another App server later. So yes that was the issue for me just another version of the same problem.

所有的答案都表明其中缺少 tomcat。在我的情况下,它被标记在我的 pom 中 <scope>provided</scope>,我认为我这样做了,因为我稍后需要在另一个应用程序服务器上运行我的应用程序。所以是的,这对我来说只是同一问题的另一个版本。

回答by Vero J

I found the reason for this to happen. Mine was that I did not include any library which brings in the tomcat runtime with it. I included the spring-web dependency and spring-boot-starter-data-jpa(shown below) but none of these packages will bring the tomcat runtime for this app to run. So, it was auto shutdown.

我找到了发生这种情况的原因。我的问题是我没有包含任何引入 tomcat 运行时的库。我包含了 spring-web 依赖项和 spring-boot-starter-data-jpa(如下所示),但这些包都不会为这个应用程序运行 tomcat 运行时。所以,它是自动关机。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-web</artifactId>
</dependency>

The solution was to change the spring-web to spring-boot-starter-web(shown below). This library brings in the tomcat library and my app started.

解决方案是将 spring-web 更改为 spring-boot-starter-web(如下所示)。这个库引入了 tomcat 库,我的应用程序启动了。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

回答by MaxFot

I just had the same problem and spent a while searching for a solution. I know the question is a few years old now but this might save someone else's time in future.

我刚刚遇到了同样的问题,并花了一段时间寻找解决方案。我知道这个问题已经有几年了,但这可能会在未来节省别人的时间。

I got this warning message when I ran mvn clean install:

我运行时收到此警告消息mvn clean install

[WARNING] error reading /Users/fotouhm/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.16/tomcat-embed-core-8.5.16.jar; zip file is empty

Turns out for some reason this file was corrupted. Just go to the link below and replace it.

原来由于某种原因,这个文件已损坏。只需转到下面的链接并替换它。

http://central.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-core/8.5.16/tomcat-embed-core-8.5.16.jar

http://central.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-core/8.5.16/tomcat-embed-core-8.5.16.jar

回答by Andras Hatvani

In my case the log4j.properties was missing.

在我的情况下,缺少 log4j.properties。

回答by stelios.anastasakis

In addition, you should check that you have at least one rest controller in your app (@RestController) and make sure you compile with spring-boot-starter-tomcat

此外,你应该检查你的应用程序中是否至少有一个 rest 控制器(@RestController)并确保你编译 spring-boot-starter-tomcat

providedRuntime ('org.springframework.boot:spring-boot-starter-tomcat')

回答by Fredrik Jonsén

In my case, I had a syntax error in application.properties:

就我而言,我有一个语法错误application.properties

application.password.numberOfLoginAttempts=5;

application.password.numberOfLoginAttempts=5;

The semicolon at the end caused Spring to shutdown silently with error code 0

最后的分号导致 Spring 以错误代码 0 静默关闭