【发布时间】:2020-05-28 13:08:36
【问题描述】:
所以我正在尝试执行https://spring.io/guides/gs/rest-service/#scratch 指南,并且我正在通过在目标选项中使用全新安装“运行为”“maven build”来安装 maven 项目。我不知道是什么问题。我也在使用 m2e 插件来运行 maven 构建,因为我搜索了其他人的答案,人们说使用 eclipse maven 命令行很糟糕。
但我在http://localhost:8080/greeting 的浏览器中收到此错误
HTTP 状态 404 – 未找到 输入状态报告
留言/问候
描述 源服务器没有找到目标资源的当前表示或不愿意透露存在。
Apache Tomcat/9.0.31
构建成功:
我已将其粘贴在这里,因为堆栈溢出将其标记为垃圾邮件,并且我再次粘贴了几行代码,因为链接未被接受:/
mockHttpServletRequest:
HTTP Method = GET
Request URI = /greeting
Parameters = {}
Headers = []
Body = null
Session Attrs = {}
Handler:
Type = com.example.restservice.GreetingController
Method = com.example.restservice.GreetingController#greeting(String)
Async:
Async started = false
Async result = null
Resolved Exception:
Type = null
ModelAndView:
View name = null
View = null
Model = null
FlashMap:
Attributes = null
MockHttpServletResponse:
Status = 200
Error message = null
Headers = [Content-Type:"application/json"]
Content type = application/json
Body = {"id":1,"content":"Hello, World!"}
Forwarded URL = null
Redirected URL = null
Cookies = []
MockHttpServletRequest:
HTTP Method = GET
Request URI = /greeting
Parameters = {name=[Spring Community]}
Headers = []
Body = null
Session Attrs = {}
Handler:
Type = com.example.restservice.GreetingController
Method = com.example.restservice.GreetingController#greeting(String)
Async:
Async started = false
Async result = null
Resolved Exception:
Type = null
ModelAndView:
View name = null
View = null
Model = null
FlashMap:
Attributes = null
MockHttpServletResponse:
Status = 200
Error message = null
Headers = [Content-Type:"application/json"]
Content type = application/json
Body = {"id":2,"content":"Hello, Spring Community!"}
Forwarded URL = null
Redirected URL = null
Cookies = []
【问题讨论】:
标签: java spring spring-boot maven spring-mvc