Rah*_*hul 6 spring spring-boot
我正在使用 spring boot 版本:2.3.5.RELEASE,仅包含我要启动的主类。当我运行主类时,我收到以下消息,并且应用程序无法启动,没有任何错误。
2020-11-03 12:39:17.871 INFO 15426 --- [ main] com.rahul.poc.HealthcheckApplication : Starting HealthcheckApplication on INMLTCU6LVCG with PID 15426 (/Users/rahul/Documents/Rahul/Projects/healthcheck/target/classes started by rahul in /Users/rahul/Documents/Rahul/Projects/healthcheck)
2020-11-03 12:39:17.873 INFO 15426 --- [ main] com.rahul.poc.HealthcheckApplication : No active profile set, falling back to default profiles: default
2020-11-03 12:39:18.617 INFO 15426 --- [ main] com.rahul.poc.HealthcheckApplication : Started HealthcheckApplication in 1.353 seconds (JVM running for 1.806)
Process finished with exit code 0
Run Code Online (Sandbox Code Playgroud)
pom.xml 如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.rahul.poc</groupId>
<artifactId>healthcheck</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Healthcheck</name>
<description>Healthcheck POC</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<!-- <scope>test</scope>-->
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
主要类为:
package com.rahul.poc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HealthcheckApplication {
public static void main(String[] args) {
SpringApplication.run(HealthcheckApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
我没有任何其他课程或配置。
Ste*_*eve 12
我相信您的问题是您没有添加一个入门包参考来将服务器组件添加到您的应用程序中,或者以其他方式添加任何保持活动状态并执行任何操作的内容。我认为您的应用程序正在运行,然后退出,因为它尚未配置为连续运行任何内容。
\n导致您的应用程序保持运行的最常见的情况是网络启动器。将其添加为 Maven 依赖项,您应该会得到更像您期望的行为:
\n<dependency>\n\xc2\xa0\xc2\xa0<groupId>org.springframework.boot</groupId>\n\xc2\xa0\xc2\xa0<artifactId>spring-boot-starter-web</artifactId>\n</dependency>\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
8256 次 |
| 最近记录: |