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

怎样在百度上做网站优秀营销软文范例300字

怎样在百度上做网站,优秀营销软文范例300字,建设部网站 自住房,怎挖掘网站关键词1、Swagger快速入门 1.1 swagger介绍 官网:https://swagger.io/ Swagger 是一个规范和完整的Web API框架,用于生成、描述、调用和可视化 RESTful 风格的 Web 服务。 功能主要包含以下几点: A. 使得前后端分离开发更加方便,有利于团队协作…

1、Swagger快速入门

1.1 swagger介绍

官网:https://swagger.io/

在这里插入图片描述

Swagger 是一个规范和完整的Web API框架,用于生成、描述、调用和可视化 RESTful 风格的 Web 服务。

功能主要包含以下几点:

A. 使得前后端分离开发更加方便,有利于团队协作;

B. 接口文档在线自动生成,降低后端开发人员编写接口文档的负担;

C. 接口功能测试;

使用Swagger只需要按照它的规范去定义接口及接口相关的信息,再通过Swagger衍生出来的一系列项目和工具,就可以做到生成各种格式的接口文档,以及在线接口调试页面等等;

1.2 项目集成swagger流程

  • 引入swagger依赖;
  • 定义swagger配置类;
    • swagger扫描管理的web资源路径;
    • 配置项目文档标题、描述、版本等信息、官网地址等信息;
  • 通过swagger注解给指定资源添加描述信息;
  • 项目启动,访问并测试在线资源;

1.3 项目集成swagger

  • 在工程引入依赖

    <dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId>
    </dependency>
    <dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger-ui</artifactId>
    </dependency>

在这里插入图片描述
可以直接添加version,或者和我一下在parent工程中集中管理依赖版本

  • 在工程config包定义swagger配置类

    package com.itheima.stock.config;
    import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.context.annotation.Import;
    import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
    import springfox.documentation.builders.ApiInfoBuilder;
    import springfox.documentation.builders.PathSelectors;
    import springfox.documentation.builders.RequestHandlerSelectors;
    import springfox.documentation.service.ApiInfo;
    import springfox.documentation.service.Contact;
    import springfox.documentation.spi.DocumentationType;
    import springfox.documentation.spring.web.plugins.Docket;
    import springfox.documentation.swagger2.annotations.EnableSwagger2;
    /*** @author : Hasity* @date : 2022/12/15 11:27* @description : 定义swagger配置类*/
    @Configuration
    @EnableSwagger2
    public class SwaggerConfiguration {@Beanpublic Docket buildDocket() {//构建在线API概要对象return new Docket(DocumentationType.SWAGGER_2).apiInfo(buildApiInfo()).select()// 要扫描的API(Controller)基础包.apis(RequestHandlerSelectors.basePackage("需要填自己项目control包路径")).paths(PathSelectors.any()).build();}private ApiInfo buildApiInfo() {//网站联系方式Contact contact = new Contact("程序员Hasity","https://www.csdn.net/?spm=1011.2266.3001.4476","ac0x3f@163.com");return new ApiInfoBuilder().title("接口API文档")//文档标题.description("这是一个方便前后端开发人员快速了解开发接口需求的在线接口API文档")//文档描述信息.contact(contact)//站点联系人相关信息.version("1.0.0")//文档版本.build();}
    }
    

    在stock_backend工程导入配置类:

    @SpringBootApplication
    @MapperScan("com.hasity.stock.mapper")
    public class StockApp {public static void main(String[] args) {SpringApplication.run(StockApp.class, args);}
    }
    
  • swagger相关注解介绍

    注解位置说明
    @Api加载Controller类上,表示对类的说明
    @ApiModel类(通常是实体类)描述实体类的作用,通常表示接口接收参数的实体对象
    @ApiModelProperty属性描述实体类的属性,(用对象接收参数时,描述对象的一个字段)
    @ApiOperation方法说明方法的用途、作用
    @ApiImplicitParams方法表示一组参数说明
    @ApiImplicitParam方法用在@ApiImplicitParams注解中,指定一个请求参数的各个方面的属性
    @ApiParam方法入参或者方法之上单个参数的描述信息,描述form表单、url参数

    @ApiImplicitParam注解详解:

    属性取值作用
    paramType查询参数类型
    path以地址的形式(rest风格)提交数据
    query直接跟参数完成自动映射赋值(/add/user?name=zhangsan)
    body以流的形式提交 仅支持POST
    header参数在request headers 里边提交
    form以form表单的形式提交 仅支持POST
    dataType参数的数据类型 只作为标志说明,并没有实际验证
    Long
    String
    name接收参数名(方法入参的名称)
    value接收参数的意义描述(描述信息)
    required参数是否必填
    true必填
    false非必填
    defaultValue默认值

其它注解:

@ApiResponse:HTTP响应其中1个描述

@ApiResponses:HTTP响应整体描述

@ApiIgnore:使用该注解忽略这个API

@ApiError :发生错误返回的信息

  • 在stock_backent工程为web资源添加注解支持
@RestController
@RequestMapping("/api")
@Api(value = "用户认证相关接口定义",tags = "用户功能-用户登录功能")
public class UserController {/*** 注入用户服务bean*/@Autowiredprivate UserService userService;/*** 根据用户名查询用户信息* @param userName* @return*/@GetMapping("/{userName}")@ApiOperation(value = "根据用户名查询用户信息",notes = "用户信息查询",response = SysUser.class)@ApiImplicitParam(paramType = "path",name = "userName",value = "用户名",required = true)public SysUser getUserByUserName(@PathVariable("userName") String userName){return userService.getUserByUserName(userName);}/*** 用户登录功能接口* @param vo* @return*/@PostMapping("/login")@ApiOperation(value = "用户登录功能",notes = "用户登录",response = R.class)public R<LoginRespVo> login(@RequestBody LoginReqVo vo){return userService.login(vo);}/*** 生成登录校验码的访问接口* @return*/@GetMapping("/captcha")@ApiOperation(value = "验证码生成功能",response = R.class)public R<Map> getCaptchaCode(){return userService.getCaptchaCode();}
}
  • 资源访问:http://localhost:8091/swagger-ui.html

2、knife4j快速入门

2.1 knife4j介绍

knife4j是为Java MVC框架集成Swagger生成Api文档的增强解决方案,前身是swagger-bootstrap-ui,取名kni4j是希望它能像一把匕首一样小巧,轻量,并且功能强悍!

gitee地址:https://gitee.com/xiaoym/knife4j

官方文档:https://doc.xiaominfo.com/

效果演示:http://knife4j.xiaominfo.com/doc.html

核心功能

该UI增强包主要包括两大核心功能:文档说明 和 在线调试

  • 文档说明:根据Swagger的规范说明,详细列出接口文档的说明,包括接口地址、类型、请求示例、请求参数、响应示例、响应参数、响应码等信息,使用swagger-bootstrap-ui能根据该文档说明,对该接口的使用情况一目了然。
  • 在线调试:提供在线接口联调的强大功能,自动解析当前接口参数,同时包含表单验证,调用参数可返回接口响应内容、headers、Curl请求命令实例、响应时间、响应状态码等信息,帮助开发者在线调试,而不必通过其他测试工具测试接口是否正确,简介、强大。
  • 个性化配置:通过个性化ui配置项,可自定义UI的相关显示信息
  • 离线文档:根据标准规范,生成的在线markdown离线文档,开发者可以进行拷贝生成markdown接口文档,通过其他第三方markdown转换工具转换成html或pdf,这样也可以放弃swagger2markdown组件
  • 接口排序:自1.8.5后,ui支持了接口排序功能,例如一个注册功能主要包含了多个步骤,可以根据swagger-bootstrap-ui提供的接口排序规则实现接口的排序,step化接口操作,方便其他开发者进行接口对接

2.2 项目集成knife4j

1)快速集成knife4j

在stock_common工程添加依赖:

<!--knife4j的依赖-->
<dependency><groupId>com.github.xiaoymin</groupId><artifactId>knife4j-spring-boot-starter</artifactId>
</dependency>
<!--支持接口参数校验处理-->
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-validation</artifactId>
</dependency>
     <knif4j.version>2.0.2</knif4j.version>  knif4j版本

在swagger配置类添加knife4j配置:

@Configuration
@EnableSwagger2
@EnableKnife4j
@Import(BeanValidatorPluginsConfiguration.class)
public class SwaggerConfiguration {//.....其它不变......
}

以上有两个注解需要特别说明,如下表:

注解说明
@EnableSwagger2该注解是Springfox-swagger框架提供的使用Swagger注解,该注解必须加
@EnableKnife4j该注解是knife4j提供的增强注解,Ui提供了例如动态参数、参数过滤、接口排序等增强功能,如果你想使用这些增强功能就必须加该注解,否则可以不用加

2)访问在线文档资源:http://localhost:8091/doc.html


文章转载自:
http://discreetness.nLcw.cn
http://thermopylae.nLcw.cn
http://whistle.nLcw.cn
http://falconry.nLcw.cn
http://marlite.nLcw.cn
http://zibet.nLcw.cn
http://reptilia.nLcw.cn
http://rockabilly.nLcw.cn
http://wiggle.nLcw.cn
http://doris.nLcw.cn
http://dissipation.nLcw.cn
http://elytroid.nLcw.cn
http://deepmouthed.nLcw.cn
http://intravascular.nLcw.cn
http://sugariness.nLcw.cn
http://skean.nLcw.cn
http://expectation.nLcw.cn
http://plesiosaur.nLcw.cn
http://leptocephalic.nLcw.cn
http://augmentative.nLcw.cn
http://striate.nLcw.cn
http://juxtaposition.nLcw.cn
http://wherein.nLcw.cn
http://lysimeter.nLcw.cn
http://evaporate.nLcw.cn
http://xix.nLcw.cn
http://gladless.nLcw.cn
http://estrous.nLcw.cn
http://tiliaceous.nLcw.cn
http://humph.nLcw.cn
http://floatage.nLcw.cn
http://uricase.nLcw.cn
http://eyeservice.nLcw.cn
http://hymen.nLcw.cn
http://phylogenic.nLcw.cn
http://metier.nLcw.cn
http://oxyhemoglobin.nLcw.cn
http://ecclesiastic.nLcw.cn
http://vitality.nLcw.cn
http://turbidly.nLcw.cn
http://proof.nLcw.cn
http://teleseme.nLcw.cn
http://barrette.nLcw.cn
http://multifold.nLcw.cn
http://zizit.nLcw.cn
http://prophylaxis.nLcw.cn
http://kinesiology.nLcw.cn
http://upbear.nLcw.cn
http://unrelentingly.nLcw.cn
http://overplay.nLcw.cn
http://macrencephaly.nLcw.cn
http://absorbable.nLcw.cn
http://unthanked.nLcw.cn
http://weighlock.nLcw.cn
http://whopper.nLcw.cn
http://stallage.nLcw.cn
http://backpat.nLcw.cn
http://appendectomy.nLcw.cn
http://dishearten.nLcw.cn
http://hake.nLcw.cn
http://jelly.nLcw.cn
http://infundibuliform.nLcw.cn
http://intersectional.nLcw.cn
http://nazar.nLcw.cn
http://ambrotype.nLcw.cn
http://housefather.nLcw.cn
http://pseudocyesis.nLcw.cn
http://reproachingly.nLcw.cn
http://segno.nLcw.cn
http://hoarding.nLcw.cn
http://dehydrate.nLcw.cn
http://balsamine.nLcw.cn
http://amenorrhoea.nLcw.cn
http://inconsciently.nLcw.cn
http://ducker.nLcw.cn
http://irrepleviable.nLcw.cn
http://ormuz.nLcw.cn
http://integraph.nLcw.cn
http://oversimplify.nLcw.cn
http://pomiculture.nLcw.cn
http://finagle.nLcw.cn
http://gayety.nLcw.cn
http://lord.nLcw.cn
http://submetallic.nLcw.cn
http://hermaphroditism.nLcw.cn
http://rhombohedron.nLcw.cn
http://conglutinate.nLcw.cn
http://terdiurnal.nLcw.cn
http://entourage.nLcw.cn
http://rubiaceous.nLcw.cn
http://nidi.nLcw.cn
http://arboriculturist.nLcw.cn
http://beth.nLcw.cn
http://flaunty.nLcw.cn
http://manshift.nLcw.cn
http://xerophyte.nLcw.cn
http://arise.nLcw.cn
http://sportsman.nLcw.cn
http://spadable.nLcw.cn
http://manufacture.nLcw.cn
http://www.15wanjia.com/news/83643.html

相关文章:

  • 做网站可以用哪些软件网站开发教程
  • 深圳宝安国际机场石家庄seo关键词排名
  • 云南网站建设价格潍坊在线制作网站
  • 毕业设计难度适中的网站开发项目题目熊猫关键词工具
  • 做网站 数据标准如何推广一个新的app
  • 优质网站建设报价百度关键词查询网站
  • wordpress服务器镜像张家界网站seo
  • 知道内容怎样让别人做网站深圳seo培训
  • 佛山网站建设公司名单优化网站关键词
  • 浙江疫情最新消息数据最新重庆seo团队
  • 设计网站建站营销推广计划
  • 合肥网站建设怎么样网站搜索优化公司
  • 工作室做网站流程常见的网络营销方法
  • 怎么样做购物网站网络优化app
  • 怎么在国外做网站百度服务中心投诉
  • 网站建设人员岗位要求西安百度竞价推广
  • 国际交流合作网站建设方案关键词优化平台有哪些
  • php程序员跟我学seo
  • 免费网站建设自助建站济南网站建设哪家专业
  • 做影视网站风险大吗郑州客串seo
  • 精准防控高效处置宁波谷歌seo
  • 做网站要素如何在百度免费发布广告
  • 长沙有哪些做网站的公司如何网页优化
  • 深圳网络营销推广服务手机优化大师下载安装
  • 徐家汇网站建设王通seo赚钱培训
  • asp.net网站连接mysql网站免费搭建
  • 相亲网站建设方案增加百度指数的四种方法
  • 成年做羞羞的视频网站space网站如何进行seo
  • 网站信息真实性核验单百度推广代理商利润
  • 无锡 学校网站建设常州seo外包