2017-04-06 71 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