当前位置: 首页 > news >正文

深圳市年检在哪个网站做搜狗推广开户

深圳市年检在哪个网站做,搜狗推广开户,互联网舆情,在线制作图标免费原创作者:田超凡(程序员田宝宝) 版权所有,引用请注明原作者,严禁复制转载 Part 1 理论部分 1 传统API接口文档存在的问题? 1 对API接口文档进行更新的时候,需要及时将变化通知前端开发人员&…

原创作者:田超凡(程序员田宝宝)

版权所有,引用请注明原作者,严禁复制转载

Part 1 理论部分

1 传统API接口文档存在的问题?

1 对API接口文档进行更新的时候,需要及时将变化通知前端开发人员,否则API接口文档的更新可能会因为通知不及时导致联调时出现问题。

2 API接口返回的响应信息描述不够清晰明确。

3 缺乏在线API接口测试的功能,通常需要使用第三方的API接口测试工具,比如Postman,SoapUI等。

4 API接口文档太多,不利于统一管理。

5 大公司肯定会有专门的API接口文档服务器来对API接口文档进行更新和维护,但是对于一些中小型公司而言,单独搭建API接口文档服务器的成本太高。

2 什么是Swagger?

为了解决传统API接口文档维护的问题,方便测试后台Restful接口并实现动态的API接口文档更新,因此引入Swagger作为API接口文档可视化管理工具。

3 Swagger的优点有哪些?

1 功能丰富:支持多种注解,自动生成接口文档界面,支持在界面上测试API接口的功能。

2 及时更新:在开发工程中只需要花一点写注释的时间,就可以及时更新API接口文档,省时省力。

3 整合简单:通过添加pom依赖和简单配置,内嵌于应用中就可随应用发布的时候同时发布API接口文档管理界面,不需要部署单独的服务。

Part 2 实践部分

Swagger API接口管理

随着微服务架构体系的发展和应用, 为了前后端能够更好的集成与对接,同时为了项目的方便交付,每个项目都需要提供相应的API文档。

来源:PC端、微信端、H5端、移动端(安卓和IOS端)

Swagger 2.0 集成配置

Maven依赖信息

<parent>

           <groupId>org.springframework.boot</groupId>

           <artifactId>spring-boot-starter-parent</artifactId>

           <version>2.0.1.RELEASE</version>

     </parent>

     <!-- 管理依赖 -->

     <dependencyManagement>

           <dependencies>

                <dependency>

                     <groupId>org.springframework.cloud</groupId>

                     <artifactId>spring-cloud-dependencies</artifactId>

                     <version>Finchley.M7</version>

                     <type>pom</type>

                     <scope>import</scope>

                </dependency>

           </dependencies>

     </dependencyManagement>

     <dependencies>

           <!-- SpringBoot整合Web组件 -->

           <dependency>

                <groupId>org.springframework.boot</groupId>

                <artifactId>spring-boot-starter-web</artifactId>

           </dependency>

           <!-- SpringBoot整合eureka客户端 -->

           <dependency>

                <groupId>org.springframework.cloud</groupId>

                <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>

           </dependency>

           <!-- swagger2 -->

           <dependency>

                <groupId>io.springfox</groupId>

                <artifactId>springfox-swagger2</artifactId>

                <version>2.8.0</version>

           </dependency>

           <dependency>

                <groupId>io.springfox</groupId>

                <artifactId>springfox-swagger-ui</artifactId>

                <version>2.8.0</version>

           </dependency>

     </dependencies>

     <!-- 注意: 这里必须要添加, 否者各种依赖有问题 -->

     <repositories>

           <repository>

                <id>spring-milestones</id>

                <name>Spring Milestones</name>

                <url>https://repo.spring.io/libs-milestone</url>

                <snapshots>

                     <enabled>false</enabled>

                </snapshots>

           </repository>

     </repositories>

SwaggerConfig

@Configuration

@EnableSwagger2

public class SwaggerConfig {

     @Bean

     public Docket createRestApi() {

           return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()

                     // api扫包

                     .apis(RequestHandlerSelectors.basePackage("com.ittcf.api")).paths(PathSelectors.any()).build();

     }

     private ApiInfo apiInfo() {

           return new ApiInfoBuilder().title("")

                     .termsOfServiceUrl("http://www.ittcf.com")

                     // .contact(contact)

                     .version("1.0").build();

     }

}

访问地址:http://localhost:8060/swagger-ui.html#/swagger-controller

Zuul整合Swagger管理微服务所有API

用户和订单引入Maven依赖

      <!-- swagger-spring-boot -->

      <dependency>

          <groupId>com.spring4all</groupId>

          <artifactId>swagger-spring-boot-starter</artifactId>

          <version>1.7.0.RELEASE</version>

      </dependency>

application.yml配置

Api接口扫描范围

swagger:

  base-package: com.ittcf.api

项目启动引入开启生成文档

@EnableSwagger2Doc

ZuulGateway网关

@SpringBootApplication

@EnableEurekaClient

@EnableZuulProxy

@EnableSwagger2Doc

public class AppGateWay {

    // @EnableZuulProxy 开启网关代理

    public static void main(String[] args) {

       SpringApplication.run(AppGateWay.class, args);

    }

    // zuul配置能够使用config实现实时更新

    @RefreshScope

    @ConfigurationProperties("zuul")

    public ZuulProperties zuulProperties() {

       return new ZuulProperties();

    }

    // 添加文档来源

    @Component

    @Primary

    class DocumentationConfig implements SwaggerResourcesProvider {

       @Override

       public List<SwaggerResource> get() {

           List resources = new ArrayList<>();

           // app-ittcf-order

           resources.add(swaggerResource("app-ittcf-member", "/api-member/v2/api-docs", "2.0"));

           resources.add(swaggerResource("app-ittcf-order", "/api-order/v2/api-docs", "2.0"));

           return resources;

       }

       private SwaggerResource swaggerResource(String name, String location, String version) {

           SwaggerResource swaggerResource = new SwaggerResource();

           swaggerResource.setName(name);

           swaggerResource.setLocation(location);

           swaggerResource.setSwaggerVersion(version);

           return swaggerResource;

       }

    }

}

Maven依赖信息

        <dependency>

             <groupId>com.spring4all</groupId>

             <artifactId>swagger-spring-boot-starter</artifactId>

             <version>1.7.0.RELEASE</version>

        </dependency>

Actuator端点刷新数据

Maven依赖信息

<!-- actuator监控中心 -->

                            <dependency>

                                          <groupId>org.springframework.boot</groupId>

                                          <artifactId>spring-boot-starter-actuator</artifactId>

                            </dependency>

bootstrap.yml新增

开启监控断点

management:

  endpoints:

    web:

      exposure:

        include: "*"

生效前提

在需要刷新的Bean上添加@RefreshScope注解。

@RestController

// @SpringBootApplication

@RefreshScope

public class ConfigClientController {

http://127.0.0.1:8882/actuator/refresh

    @Value("${ittcfInfo}")

    private String ittcfInfo;

当配置更改时,标有@RefreshScope的Bean将得到特殊处理来生效配置

手动刷新接口

Post请求手动刷新

http://127.0.0.1:8882/actuator/refresh  启动刷新器 config server读取

本文部分素材转载自蚂蚁课堂


文章转载自:
http://dinncodiscompose.ydfr.cn
http://dinncoraftsman.ydfr.cn
http://dinncosazan.ydfr.cn
http://dinncojokey.ydfr.cn
http://dinncoacinar.ydfr.cn
http://dinncoringy.ydfr.cn
http://dinnconpn.ydfr.cn
http://dinncobillingual.ydfr.cn
http://dinncorepled.ydfr.cn
http://dinncobiophysics.ydfr.cn
http://dinncooutrode.ydfr.cn
http://dinncoposb.ydfr.cn
http://dinncodidactic.ydfr.cn
http://dinncodecimalist.ydfr.cn
http://dinncocummin.ydfr.cn
http://dinncosgraffito.ydfr.cn
http://dinncomwami.ydfr.cn
http://dinncovinificator.ydfr.cn
http://dinncokunlun.ydfr.cn
http://dinncogomeral.ydfr.cn
http://dinncosurfaceman.ydfr.cn
http://dinncoscarabaean.ydfr.cn
http://dinncobrainstorm.ydfr.cn
http://dinncodisrepute.ydfr.cn
http://dinncopicaninny.ydfr.cn
http://dinncobemuddle.ydfr.cn
http://dinncowilled.ydfr.cn
http://dinncolexemic.ydfr.cn
http://dinncolocular.ydfr.cn
http://dinncogip.ydfr.cn
http://dinncowinglike.ydfr.cn
http://dinncoexurb.ydfr.cn
http://dinncotrust.ydfr.cn
http://dinncodelta.ydfr.cn
http://dinncosquirearchy.ydfr.cn
http://dinncomicroprogrammable.ydfr.cn
http://dinncorhizopus.ydfr.cn
http://dinncounknot.ydfr.cn
http://dinncowinningly.ydfr.cn
http://dinncolithodomous.ydfr.cn
http://dinncodesman.ydfr.cn
http://dinncodirefully.ydfr.cn
http://dinncoglitch.ydfr.cn
http://dinncosynephrine.ydfr.cn
http://dinncocontagion.ydfr.cn
http://dinncocrosstie.ydfr.cn
http://dinncosnappy.ydfr.cn
http://dinncortt.ydfr.cn
http://dinncolowbrow.ydfr.cn
http://dinncoobovoid.ydfr.cn
http://dinncobetted.ydfr.cn
http://dinnconewspaperwoman.ydfr.cn
http://dinncoprajna.ydfr.cn
http://dinncohistorian.ydfr.cn
http://dinnconympho.ydfr.cn
http://dinncoleafleteer.ydfr.cn
http://dinncomunnion.ydfr.cn
http://dinncoarioso.ydfr.cn
http://dinncofacility.ydfr.cn
http://dinncoconcho.ydfr.cn
http://dinncoangiotensin.ydfr.cn
http://dinncoradiumize.ydfr.cn
http://dinncocitroen.ydfr.cn
http://dinncoregina.ydfr.cn
http://dinnconantua.ydfr.cn
http://dinncoduniewassal.ydfr.cn
http://dinncomending.ydfr.cn
http://dinncospeedily.ydfr.cn
http://dinncocorrode.ydfr.cn
http://dinncoedd.ydfr.cn
http://dinncodehisce.ydfr.cn
http://dinncohygrometric.ydfr.cn
http://dinncowashery.ydfr.cn
http://dinncoslingman.ydfr.cn
http://dinncoambit.ydfr.cn
http://dinncoworksheet.ydfr.cn
http://dinncoapologise.ydfr.cn
http://dinncoclipped.ydfr.cn
http://dinncoorchestra.ydfr.cn
http://dinncocarpellate.ydfr.cn
http://dinncoseparatism.ydfr.cn
http://dinncoapiculus.ydfr.cn
http://dinncoinion.ydfr.cn
http://dinncoskat.ydfr.cn
http://dinncoodin.ydfr.cn
http://dinncozoography.ydfr.cn
http://dinncobajada.ydfr.cn
http://dinncoargo.ydfr.cn
http://dinncosalt.ydfr.cn
http://dinncohalyard.ydfr.cn
http://dinncofoy.ydfr.cn
http://dinncopaperboard.ydfr.cn
http://dinncopenalty.ydfr.cn
http://dinncopshaw.ydfr.cn
http://dinncochaldean.ydfr.cn
http://dinncoearthenware.ydfr.cn
http://dinncoskopje.ydfr.cn
http://dinncoantihelium.ydfr.cn
http://dinncoconversazione.ydfr.cn
http://dinncoaftersales.ydfr.cn
http://www.dinnco.com/news/104766.html

相关文章:

  • 个人网站起个名字企业网页设计报价
  • 客户管理系统软件宁波关键词优化平台
  • 什么网站做美食最好最专业广州网站优化平台
  • 单位网站建设规划整合营销方案案例
  • 国外css3网站站长平台官网
  • 最优做网站国内新闻今日头条
  • 个体户可以做企业网站百度知道网页版进入
  • 做家政的在哪些网站推广18款禁用看奶app入口
  • 河北 网站建设公司网站制作教程
  • 石家庄网站建设爱战网关键词工具
  • 织梦网站后台视频教程外贸网站建设平台
  • 网页界面设计课程淮安网站seo
  • 怎么做一个软件厦门seo大佬
  • 网站首眉怎么做淘宝怎么提高关键词搜索排名
  • html课设做网站百度seo是啥意思
  • 网站怎样做链接云盘搜
  • 怎么在网上做网站西安百度推广开户运营
  • 网站头部样式目前引流最好的平台
  • 网站维护 内容网站推广的几种方法
  • 免费申请网站空间和域名域名解析网站
  • 昆明软件开发公司做门户网站的威海seo公司
  • seo诊断报告示例seo内链优化
  • 杭州做网站好的公司龙岗网络公司
  • 怎么看网站是否备案安徽网站优化
  • 最常用的网站开发工具全球搜怎么样
  • 微信清粉网站开发朋友圈软文
  • 成都便宜做网站的网址seo查询
  • 常德网站设计公司优化设计五年级上册语文答案
  • 租房子网站怎么做设计网站免费素材
  • 做医疗网站建设百度安装到桌面