Search code examples
springweb-servicesrestantenunciate

Enunciate framework - Not working with Spring Restful project


I have integrated enunciate framework to generate the API document for the Spring RESTful project. I have followed the steps from https://github.com/stoicflame/enunciate/wiki/Executables and deployed the war created from the enunciate configuration in the tomcat server(http://localhost:8080/sample_enunciate) but its displaying the empty document. Here I have provided the configuration details used in the sample project.

NOTE: But the similar configuration is working with Jersey restful project. I really stuck here. Please let me know, is this bug with the enunciate framework integration with Spring project. Thanks in advance.

Project configuration:

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

jars:

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

This is my 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>

properties file for build.xml

enunciate_build.properties

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

This is my 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>

Solution

  • Enunciate only recognizes JAX-RS annotations right now. For further information follow this link.https://github.com/stoicflame/enunciate/issues/60