2017-04-06 50 views
-1

我正在使用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) 

控制台日志状态。当我运行应用程序作为弹簧启动应用程序并进入

http://localhost:9001/hello-world

的我在屏幕上看到的回复如下。

{"timestamp":1491514947950,"status":404,"error":"Not Found","message":"No message available","path":"/hello-world"} 

谁能帮助我了解为什么我没有得到响应,

{"id":1,"content":"Hello, Stranger!"} 
+1

这个例子提到'curl http:// localhost:9000/hello-world'来得到预期的答案,但你显然使用了端口9001.或者它是一个错字? –

回答

0

端口9001是端点(健康指标和类似)。端口9000是您的应用程序的内容,其中HelloWorldController是。如文档和@Marc Tarin所述,使用http://localhost:9000/hello-world