STS:使用 Spring MVC 无法运行的服务 Web 内容

STS: Serving Web Content with Spring MVC not working

在 STS 上,您可以导入 Spring 入门指南,所以我用 "Serving Web Content with Spring MVC now working" 做了(因为 "complete" 而不是 "initial")。然后我以调试模式启动服务器,期望一切正常,但我得到:

HTTP Status 404 – Not Found
Type Status Report

Message /greeting

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

对我来说,似乎一切正常,因为终点设置正确,如 guide 解释:@RequestMapping("/greeting")

编辑 1: 当我尝试访问端点时,我的任何控制台都没有错误: Pivotal tc Server Developer Edition v3.2:

mar 07, 2018 10:06:37 AM org.apache.catalina.startup.Catalina load
INFORMAZIONI: Initialization processed in 2138 ms
mar 07, 2018 10:06:47 AM org.apache.catalina.startup.Catalina start
INFORMAZIONI: Server startup in 9346 ms

AJDT 事件跟踪:

10:7:52 Startup information: 
   AJDT version: 2.2.4.201710301818
   AspectJ Compiler version: DEVELOPMENT
   usingVisualiser=true
   usingXref=true
   usingCUprovider=true
   ajde.version.at.previous.startup = 2.2.4.201710301818

Java 堆栈跟踪:

Paste stack traces into this console and follow hyperlinks to source code.

Maven:空!

HostOSGi:

Paste stack traces into this console and follow hyperlinks to source code.

看来我运行和我想象的不一样。我的包资源管理器:

您似乎在尝试将 Spring 启动应用程序部署到本地 运行 tc 服务器实例。你不需要那样做。只需打开 Boot Dashboard 视图,select 您的引导项目,然后单击“(Re)Start”。

它以嵌入式 Tomcat 实例启动,这是 Spring 引导的默认实例,适用于所有指南 out-of-the-box。