Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot org.apache.http.conn.HttpHostConnectException:连接到本地主机:8080[localhost/127.0.0.1]失败:连接被拒绝:连接_Spring Boot - Fatal编程技术网

Spring boot org.apache.http.conn.HttpHostConnectException:连接到本地主机:8080[localhost/127.0.0.1]失败:连接被拒绝:连接

Spring boot org.apache.http.conn.HttpHostConnectException:连接到本地主机:8080[localhost/127.0.0.1]失败:连接被拒绝:连接,spring-boot,Spring Boot,我是SpringBoot新手,正在使用HTTPAPI测试SpringBoot应用程序,但我遇到了连接错误 得到 org.apache.http.conn.HttpHostConnectException:连接到本地主机:8080[localhost/127.0.0.1]失败:连接被拒绝:连接 它可以很好地运行主java文件 请告诉我哪里做错了。谢谢。当你说helloworld.http,确切的意思是什么?执行测试时,您确定服务器已启动并正在运行吗?你能提供你的考试课程吗?哦,谢谢!我真是

我是SpringBoot新手,正在使用HTTPAPI测试SpringBoot应用程序,但我遇到了连接错误

得到

org.apache.http.conn.HttpHostConnectException:连接到本地主机:8080[localhost/127.0.0.1]失败:连接被拒绝:连接

它可以很好地运行主java文件


请告诉我哪里做错了。谢谢。

当你说
helloworld.http
,确切的意思是什么?执行测试时,您确定服务器已启动并正在运行吗?你能提供你的考试课程吗?哦,谢谢!我真是太蠢了,我打开了服务器,它工作了。别担心,我们都经历过类似的事情。。。你会习惯的;)当你说helloworld.http时,它到底是什么?执行测试时,您确定服务器已启动并正在运行吗?你能提供你的考试课程吗?哦,谢谢!我真是太蠢了,我打开了服务器,它工作了。别担心,我们都经历过类似的事情。。。你会习惯的;)
//HelloWorldController.java
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class HelloWorldController {
    @GetMapping(value="/api/helloworld")
    public String helloWorld(){
        return "helloworld";
    }
}
//helloworld.http    
GET http://localhost:8080/api/helloworld