使用Enanciate 2.6和spring框架

时间:2016-09-16 07:29:53

标签: spring rest enunciate

我有春季4申请我试图记录休息api。

这在我的pom.xml中:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>com.webcohesion.enunciate</groupId>
            <artifactId>enunciate-maven-plugin</artifactId>
            <version>2.6.0</version>
            <configuration>
                <sourcepath-includes>
                    <include>
                        <groupId>org.springframework.data</groupId>
                    </include>
                </sourcepath-includes>
                <configFile>${basedir}/src/main/resources/doc/enunciate/config.xml</configFile>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>assemble</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

我的enunciate.xml文件:

<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="http://enunciate.webcohesion.com/schemas/enunciate-2.6.0.xsd">
<title> TITLE </title>
<description>desc .... </description>
<copyright>copyright</copyright>
<api-classes>
    <include pattern="com.myexample.**"/>
    <include pattern="org.springframework.data.domain.Pageable"/>
    <include pattern="org.springframework.data.domain.Page"/>
    <include pattern="org.springframework.data.domain.Slice"/>
</api-classes>
<modules>
    <docs docsSubdir="enunciate/docs" />
    <spring-app disable="false" springVersion="4.2.4" />
    <spring-web disable="false" datatype-detection="aggressive" />
    <!--<gwt-json-overlay disabled="true"/>
    <obj-c-xml-client disabled="true"/>
    <php-xml-client disabled="true"/>
    <php-json-client disabled="true"/>
    <ruby-json-client disabled="true"/>
    <xml disabled="true"/>
    <c-xml-client disable="true"/>
    <swagger disabled="true"/>
    <java-client disabled="true"/>
    <java-json-client disabled="true"/>
    <javascript-client disabled="true"/>
    <csharp-xml-client disabled="true"/>
    <java-xml-client disabled="true"/>
    <c disabled="true"/>
    <idl disabled="true"/>
    <basic-app disabled="true" />-->
</modules>

我在控制器中的简单方法:

/**
 * docs for method getUsers .....
 *
 * @param pageable org.springframework.data.domain.Pageable
 * @return org.springframework.data.domain.Page
 *
 */
//@com.webcohesion.enunciate.metadata.rs.TypeHint(value = PageDoc.class)
@RequestMapping(method = RequestMethod.GET)
public Page<User> getUsers(Pageable pageable)
{
    List<User> users = userDatastore.findAll(0, 10);
    //Pageable pageable = new PageRequest(0, 5, new Sort(Sort.Direction.ASC, "username"));
    System.out.println("pageable : " + pageable.toString());
    return new PageImpl<User>(users, pageable, 10);
}

问题在于是不是文档Page和Pageable类。知道我应该怎么做吗?

0 个答案:

没有答案