【问题标题】:Add javadocs to show on a webpage添加 javadocs 以显示在网页上
【发布时间】:2013-08-16 13:26:12
【问题描述】:

有什么方法可以显示我通过 eclipse 生成的 javadocs 以在我的 Spring mvc 项目的网页上显示它们?我知道我必须对控制器做点什么,但是什么?

提前致谢!

【问题讨论】:

  • 您是否尝试过为 Eclipse 使用 JAutoDoc 插件?

标签: eclipse spring-mvc view javadoc webpage


【解决方案1】:

您可以在应用程序的某个文件夹中生成 javadocs(如 /WEB-INF/docs/)并指示 Spring 将它们作为 static resources(它们是)提供:

<mvc:resources mapping="/docs/**" location="/WEB-INF/docs/" /> 

然后您可以使用 http://localhost:8080/yourAppContext/docs/index.html 之类的内容访问它们。

根据您的应用程序 URL 映射,甚至可以在公开可用的文件夹(WEB-INF 之外)中生成文件,并让服务器本身从那里为它们提供服务,而不会触发 Spring 调度程序 servlet。

【讨论】:

  • 调试:[aug-20 14:46:18,111] method.annotation.RequestMappingHandlerMapping - 查找路径 /docs/index.html 的处理程序方法调试:[aug-20 14:46:18,116] method.annotation.RequestMappingHandlerMapping - 未找到 [/docs/index.html] 的处理程序方法 警告:[aug-20 14:46:18,116] web.servlet.PageNotFound - 未找到带有 URI 的 HTTP 请求的映射 [/pyramidstatus/ docs/index.html] 在 DispatcherServlet 中,名称为“restservices”
  • @benskiiii:正如我在回答中所说,您必须instruct Spring to treat the javadoc pages as static resources。从您发布的评论看来,Spring 正在尝试将您的请求映射到控制器并失败。查看您的配置文件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-02-18
  • 2012-09-12
  • 2019-07-11
  • 2018-12-18
相关资源
最近更新 更多