• 授权协议:Apache
  • 开发厂商:-
  • 软件语言:Java
  • 更新日期:2018-10-20
HttpDoc

HttpDoc 零侵入的 RESTful API 文档框架

HttpDoc 零侵入的 RESTful API 文档框架 项目简介

HttpDoc 基于Java标准doc注释构建的代码零侵入的HTTP RESTful API在线阅览文档及测试界面框架JSON-Editor: httpdoc-ui TextArea: httpdoc-ui-v1功能特性基础功能无需为配合HttpDoc框架而多写一句代码,甚至连doc注释都不必写,即可拥有项目的API文档和测试界面。遵循 RFC 2616 HTTP/1.1 规范,适配主流后台WEB框架。拓展多个 Java Doc 注释标签,满足不同的文档阅览及在线测试需求。一键生成SDK,支持多个平台,让前后台以及跨平台对接变得更简单。WEB服务器无关,同时支持 Spring Boot 命令方式启动。支持 Maven Gradle 或JAR包依赖。环境依赖JDK 1.7 +集成步骤Maven引入依赖<project>
    <!-- 设置 jitpack.io 仓库 -->
    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://www.jitpack.io</url>
        </repository>
    </repositories>

    <dependencies>
        <!-- 添加 HttpDoc 依赖 -->
        <dependency>
            <groupId>com.github.core-lib.httpdoc</groupId>
            <artifactId>httpdoc-spring-mvc</artifactId>
            <version>v1.5.3</version>
        </dependency>
        
        <!-- 添加JDK的tools.jar依赖用于解析源码注释,采用这种方式部署到Tomcat时需要往Tomcat的lib目录增加该tools.jar -->
        <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.8</version>
            <scope>system</scope>
            <systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
        </dependency>
        <!-- 当然还有很多种方式来依赖tools.jar,例如上传到自己的私服或从别的仓库中依赖进来 -->
    </dependencies>
</project>配置插件<!-- 由于框架基于源码注释解析来实现,所以保留源码是基础,如果只想要在线测试而没有文档阅览的需求,可不必添加该插件。-->
<!-- 如果项目是多模块项目,需要被解析的源码类分散在多模块中,则其他模块也需要配置该插件,或在父项目的pom.xml中配置该插件。-->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.1.0</version>
    <configuration>
        <encoding>UTF-8</encoding>
    </configuration>
    <executions>
        <execution>
            <id>copy-src</id>
            <phase>process-sources</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/classes</outputDirectory>
                <resources>
                    <resource>
                        <directory>${basedir}/src/main/java</directory>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>配置参数SpringMVC<web-app>
    <servlet>
        <servlet-name>httpdoc</servlet-name>
        <servlet-class>io.httpdoc.web.HttpdocServletSupport</servlet-class>
        <init-param>
            <param-name>httpdoc</param-name>
            <param-value>项目名称</param-value>
        </init-param>
        <init-param>
            <param-name>version</param-name>
            <param-value>项目版本</param-value>
        </init-param>
        <init-param>
            <param-name>description</param-name>
            <param-value>
                <![CDATA[
                    项目描述(可以内嵌HTML标签)
                ]]>
            </param-value>
        </init-param>
        <init-param>
            <param-name>dateFormat</param-name>
            <param-value>yyyy-MM-dd HH

HttpDoc 零侵入的 RESTful API 文档框架 相关推荐

HttpDoc 零侵入的 RESTful API 文档框架 评论内容