【发布时间】:2017-09-02 03:24:25
【问题描述】:
我正在使用 SpringBoot 学习 WebServices。
我遇到了这个例子spring-actuator-service
控制台日志显示以下内容
2017-04-07 03:04:59.281 INFO 13024 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9001 (http)
2017-04-07 03:04:59.290 INFO 13024 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2017-04-07 03:04:59.548 INFO 13024 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9000 (http)
2017-04-07 03:04:59.555 INFO 13024 --- [ main] hello.HelloWorldConfiguration : Started HelloWorldConfiguration in 8.274 seconds (JVM running for 9.183)
当我将应用程序作为 Spring Boot 应用程序运行并进入
http://localhost:9001/hello-world
我在屏幕上得到的响应如下。
{"timestamp":1491514947950,"status":404,"error":"Not Found","message":"No message available","path":"/hello-world"}
谁能帮我理解为什么我没有得到响应
{"id":1,"content":"Hello, Stranger!"}
【问题讨论】:
-
该示例提到
curl http://localhost:9000/hello-world以获得预期的答案,但您显然使用了端口 9001。或者它是一个错字?
标签: java json spring-boot