Enunciate框架 - 不适用于Spring Restful项目

时间:2015-04-07 13:18:51

标签: spring web-services rest ant enunciate

我已经集成了enunciate框架来为Spring RESTful项目生成API文档。我已经按照https://github.com/stoicflame/enunciate/wiki/Executables中的步骤操作并部署了tomcat服务器(http://localhost:8080/sample_enunciate)中的enunciate配置创建的war,但它显示了空文档。这里我提供了示例项目中使用的配置详细信息。

注意:但类似的配置正在与Jersey restful项目一起使用。我真的卡在这里请让我知道,这是与Spring项目的enunciate框架集成的错误。提前谢谢。

项目配置:

java       -1.7.0
tomcat     -6.0 &7.0
ant        -1.9.4
spring     -4.0.5
enunciate  -1.30

罐子:

enunciate-core-1.30-RC1.jar
enunciate-core-annotations-1.30-RC1.j
enunciate-core-rt-1.30-RC1.jar
enunciate-java-client-1.30-RC1.jar
enunciate-docs-1.30-RC1.jar
enunciate-rt-1.30-RC1.jar
enunciate-spring-app-rt-1.30-RC1.jar
enunciate-spring-jaxws-rt-1.30-RC1.ja

spring-aop-4.0.5.RELEASE.jar
spring-beans-4.0.5.RELEASE.jar
spring-context-4.0.5.RELEASE.jar
spring-context-support-2.5.4.jar
spring-core-4.0.5.RELEASE.jar
spring-expression-4.0.5.RELEASE.jar
spring-jdbc-4.0.5.RELEASE.jar
spring-test-4.0.5.RELEASE.jar
spring-tx-4.0.5.RELEASE.jar
spring-web-4.0.5.RELEASE.jar
spring-webmvc-4.0.5.RELEASE.jar

这是我的enunciate.xml。

enunciate.xml

<?xml version="1.0"?>

<api-classes>
    <include pattern="com.sample.controller.*" />
</api-classes>
<modules>
    <!-- Docs -->
     <docs  title="example" copyright="Example.com"/>
     <webapp mergeWebXML="WebContent/WEB-INF/web.xml" />
    <spring-app disabled="false" springVersion="4.0.5">
        <springImport file="resources/dev/applicationContext.xml" />    
        <springImport file="WebContent/WEB-INF/rest-servlet.xml" />     
    </spring-app>
    <c disabled="true" />
    <csharp disabled="true" />
    <java-client disabled="false" />
    <cxf disabled="false" />
    <gwt disabled="false" />
    <jaxws-client disabled="true" />
    <jaxws-ri disabled="true" />
    <jaxws-support disabled="true" />
    <jersey disabled="true" />
    <xml disabled="false" />
    <obj-c disabled="true" />
    <rest disabled="false" />
</modules>

build.xml的属性文件

enunciate_build.properties

JAVA_HOME=C:/Java/jdk1.7.0/
tomcat.home=D:/xampp/tomcat

这是我的build.xml

的build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project default = "enunciate">
    <property file ="enunciate_build.properties"/>
    <property name="lib.dir" value="../libs" />
    <property name="src.dir" value="src"/>
    <target name = "enunciate">
        <path id= "enunciate.classpath">
            <fileset dir = "${lib.dir}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir ="${lib.dir}/modules/spring">
                <include name="*.jar"/>
            </fileset>  
             <fileset dir = "${JAVA_HOME}">
                <include name = "lib/tools.jar"/>
            </fileset>
        </path> 
            <taskdef name="enunciate" classname = "org.codehaus.enunciate.main.EnunciateTask">  
            <classpath refid = "enunciate.classpath"/>
            </taskdef>
            <enunciate javacSourceVersion="1.7" javacTargetVersion="1.7" basedir = "${src.dir}" configFile="enunciate.xml">
                <include name = "**/*.java"/>               
                <classpath refid= "enunciate.classpath"/>
            <export artifactId="war.file" destination="${tomcat.home}/webapps/sample_enunciate.war"/>   
            </enunciate>    

    </target>
</project>

1 个答案:

答案 0 :(得分:0)

Enunciate目前仅识别JAX-RS注释。有关详细信息,请访问此链接。https://github.com/stoicflame/enunciate/issues/60