【Spring Boot】执行后立即以「code 0」即刻结束

在创建项目后立即运行时,会立即以“code 0”结束.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.5.4)

//any logs
//any logs

Process finished with exit code 0

已经解决

将build.gradle中的spring-boot-starter更改为spring-boot-starter-web后,程序运行正常。

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

↑将这样操作
↓这样做后它就动了。

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
bannerAds