【发布时间】:2014-01-23 20:04:33
【问题描述】:
我有一个 Spring 3 应用程序,我正在尝试针对它生成健壮的 api 文档。我已经尝试了几个不同的项目,并且正在查看 enunicate(http://enunciate.codehaus.org) 是否能满足我的需求,包括生成 swagger 格式文档的能力。
我已将依赖项添加到我的 pom.xml 文件中,如下所示
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-spring-plugin</artifactId>
<version>1.27</version>
<configuration>
<configFile>enunciate.xml</configFile>
</configuration>
<executions>
<execution>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
并在我的应用程序的根目录中创建了一个简单的 enunciate.xml 文件:
<?xml version="1.0"?>
<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.28.xsd">
<services>
<rest defaultRestSubcontext="/"/>
<soap defaultSoapSubcontext="/"/>
</services>
<webapp mergeWebXML="src/main/webapp/WEB-INF/web.xml" />
<modules>
<spring-app disabled="false"></spring-app>
<docs docsDir="api" splashPackage="com.welflex.rest" title="Web Service API"
copyright="MyCo"/>
<obj-c disabled="true"></obj-c>
<c disabled="true"/>
<csharp disabled="true"></csharp>
<swagger disabled="false"></swagger>
</modules>
</enunciate>
当我对我的项目运行 mvn clean package 时,只选择了几个具有 jax-ws 注释的类。
有人有使用 enunciate 的 Spring/REST/JSON 控制器的工作示例吗?
谢谢!
【问题讨论】:
标签: rest spring-mvc enunciate