gpt4 book ai didi

java - 使用 Spring STS 运行示例 Spring MVC 时出现错误 404

转载 作者:行者123 更新时间:2023-12-01 15:30:46 25 4
gpt4 key购买 nike

我尝试在 Eclipse 中使用 Spring STS 运行示例 Spring MVC,但是当我尝试使用我的帐户在 CloudFoundry 上运行它时,当我访问“映射的 URL”时,我收到错误 404

它至少应该显示“Hello World”并显示服务器时间。

我想知道为什么它没有运行?我在控制台中没有看到任何错误。

编辑:这是完整的console log.

最佳答案

未检测到您的 Controller ,我认为您忘记配置 spring 来扫描您的应用程序以查找基于注释的 Controller :

   <context:component-scan base-package="mypackage.com...."/>
<context:annotation-config/>

http://renidev.wordpress.com/2009/02/02/how-to-use-springs-context-component-scan-and-annotation/

关于java - 使用 Spring STS 运行示例 Spring MVC 时出现错误 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9531497/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com