我是 Spring Boot 的初学者。我初始化了一个新项目并尝试运行它,但它没有成功运行。当我将其作为 Spring Boot 应用程序运行时,它就会开始执行。在底部编译器/状态栏中,它显示处理和重试。它最多运行 10 次并抛出以下错误:
无法刷新进程 xxxx 的实时数据 https://i.stack.imgur.com/Q7VPO.jpg
更多详细信息请点击这里 https://i.stack.imgur.com/GWM0m.png
TanmayTestApplication.java
package com.example.tanmay_test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class TanmayTestApplication {
public static void main(String[] args) {
SpringApplication.run(TanmayTestApplication.class, args);
}
}
演示控制器.java
package com.example.cntr;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
@RestController
public class DemoControler {
@RequestMapping(path = "/index")
public String index() {
return "By Tanmay!";
}
}
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.2.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>tanmay_test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>tanmay_test</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</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>
我在 STS 中遇到了同样的问题,并尝试了不同的方法来解决它。弹簧致动器的以下依赖性使该问题消失,但是弹簧致动器的要点提供了比这更多的功能。要了解更多信息,请点击https://docs.spring.io/spring-boot/docs/current/reference/html/product-ready-features.html https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html
应将依赖项添加到您的 pom.xml 文件中
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)