Dubbo 的 Swagger 服务文档 swagger-dubbo

码农软件 · 软件分类 · 程序文档工具 · 2019-12-10 11:58:41

软件介绍

swagger-dubbo支持dubbo以swagger方式展示文档和rest风格的HTTP模拟测试,主要应用场景有以下几点:

  • 通过dubbo与swagger的集成,提供接口文档的阅读

  • 开发人员可以用它来自测服务接口,也可以用它来模拟别人的服务接口返回值

  • 测试可以用它来验证接口的正确性,基于HTTP进行接口测试

swagger-dubbo从某些方面提高了内部开发测试的效率,注意的是,rest服务不适合对外(前端)提供,务必在服务端或者测试内部使用。

Maven

<dependency>
  <groupId>com.deepoove</groupId>
  <artifactId>swagger-dubbo</artifactId>
  <version>2.0.1</version>
</dependency>

两步集成

一. 使用注解 @EnableDubboSwagger开启dubbo的swagger文档。

package com.deepoove.swagger.dubbo.example;

import org.springframework.context.annotation.Configuration;
import com.deepoove.swagger.dubbo.annotations.EnableDubboSwagger;

@Configuration
@EnableDubboSwagger
public class SwaggerDubboConfig {

}

二. 在spring的*-servlet.xml配置中,开启属性占位符的配置,开启Configuration注解,声明SwaggerDubboConfig。

<context:annotation-config />
<bean class="com.deepoove.swagger.dubbo.example.SwaggerDubboConfig" />
<context:property-placeholder />

集成已经完毕,启动web容器,浏览器访问 http://ip:port/context/swagger-dubbo/api-docs查看文档。

SpringBoot 集成 Swagger-dubbo

SpringBoot对配置做了简化,集成swagger-dubbo只需要使用注解 @EnableDubboSwagger开启dubbo的swagger文档即可。

本文地址:https://codercto.com/soft/d/20836.html

Computational Advertising

Computational Advertising

by Kushal Dave、Vasudeva Varma / Now Publishers Inc / 2014

Computational Advertising (CA), popularly known as online advertising or Web advertising, refers to finding the most relevant ads matching a particular context on the Web. The context depends on the t......一起来看看 《Computational Advertising》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试