【问题标题】:Using Enanciate to document a Spring MVC REST api使用 Enancate 记录 Spring MVC REST api
【发布时间】: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


    【解决方案1】:

    不幸的是,Enunciate 仅支持标准的 JAX-RS 接口注释。尚不支持 Spring MVC。 Here's where we're tracking that work.

    【讨论】:

    • 不知道为什么你有重复的链接。这些链接现在已经失效,但这个链接看起来像一个类似的问题:github.com/stoicflame/enunciate/issues/60。奇怪的是,你的脸在那个问题上......
    猜你喜欢
    • 1970-01-01
    • 2017-10-28
    • 1970-01-01
    • 2020-09-12
    • 2019-11-14
    • 1970-01-01
    • 1970-01-01
    • 2020-02-02
    • 1970-01-01
    相关资源
    最近更新 更多