Why does Spring Boot web app close immediately after starting?

后端 未结 10 2315
南笙
南笙 2021-02-18 15:57

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, t

相关标签:
10条回答
  • 2021-02-18 16:44

    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

    providedRuntime ('org.springframework.boot:spring-boot-starter-tomcat')
    
    0 讨论(0)
  • 2021-02-18 16:45

    In my case the log4j.properties was missing.

    0 讨论(0)
  • 2021-02-18 16:47

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

    application.password.numberOfLoginAttempts=5;

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

    0 讨论(0)
  • 2021-02-18 16:48

    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.

    <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.

    0 讨论(0)
提交回复
热议问题