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

个人怎么做公司网站台州网站制作维护

个人怎么做公司网站,台州网站制作维护,wordpress多作者,网站怎么上传模板SpringBoot集成knife4j 1、什么是Knife4j2、SpringBoor整合Knife4j2.1、Knife4j配置方式12.2 配置方式二2.3、写注解2.4、效果 1、什么是Knife4j 在日常开发中,写接口文档是我们必不可少的,而Knife4j就是一个接口文档工具,可以看作是Swagger…

SpringBoot集成knife4j

  • 1、什么是Knife4j
  • 2、SpringBoor整合Knife4j
    • 2.1、Knife4j配置方式1
    • 2.2 配置方式二
    • 2.3、写注解
    • 2.4、效果

1、什么是Knife4j

在日常开发中,写接口文档是我们必不可少的,而Knife4j就是一个接口文档工具,可以看作是Swagger的升级版,但是界面比Swagger更好看,功能更丰富

早期,swagger-boostrap-ui是1.x版本,如今swagger-bootsrap-ui到2.x,同时也更改名字Knife4j,适用于单体和微服务项目。

Knife4j官方网站

2、SpringBoor整合Knife4j

2.1、Knife4j配置方式1

1、引入Knife4j相关依赖

<dependency><groupId>com.github.xiaoymin</groupId><artifactId>knife4j-spring-boot-starter</artifactId><version>2.0.8</version>
</dependency>
<dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional>
</dependency>

2、创建Knife4J配置类

package com.heima.common.swagger;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.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;@Configuration
@EnableSwagger2
@EnableKnife4j
@Import(BeanValidatorPluginsConfiguration.class)
public class Swagger2Configuration {@Bean(value = "defaultApi2")public Docket defaultApi2() {Docket docket=new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())//分组名称.groupName("1.0").select()//这里指定Controller扫描包路径.apis(RequestHandlerSelectors.basePackage("com.heima")).paths(PathSelectors.any()).build();return docket;}private ApiInfo apiInfo() {return new ApiInfoBuilder().title("黑马头条API文档").description("黑马头条API文档").version("1.0").build();}
}

3、把配置的bean注入spring
在这里插入图片描述

2.2 配置方式二

1、引入Knife4j相关依赖

<dependency><groupId>com.github.xiaoymin</groupId><artifactId>knife4j-spring-boot-starter</artifactId><version>2.0.8</version>
</dependency>
<dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional>
</dependency>

2、写配置
在这里插入图片描述
在application.yml文件中配置

knife4j:enable: trueopenapi:title: 用户管理接口文档description: "用户管理接口文档"email: zhanghuyi@itcast.cnconcat: 虎哥url: https://www.itcast.cnversion: v1.0.0group:default:group-name: defaultapi-rule: packageapi-rule-resources:- com.itheima.mp.controller

2.3、写注解

package com.heima.user.controller.v1;import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.LoginDto;
import com.heima.user.service.ApUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@RequestMapping("/api/v1/login")
@Api(value = "app端用户登录",tags = "app端用户登录")
public class ApUserLoginController {@Autowiredprivate ApUserService apUserService;@PostMapping("/login_auth")@ApiOperation("用户登录")public ResponseResult login(@RequestBody LoginDto dto){return apUserService.login(dto);}
}

2.4、效果

此时运行项目,访问 IP+端口/doc.html

在这里插入图片描述


文章转载自:
http://dinncosprinkling.stkw.cn
http://dinncoarmoury.stkw.cn
http://dinncosecessionism.stkw.cn
http://dinncofunctionate.stkw.cn
http://dinncoflagellate.stkw.cn
http://dinncoenuresis.stkw.cn
http://dinncosyntactically.stkw.cn
http://dinncoheartbreaking.stkw.cn
http://dinncostraw.stkw.cn
http://dinncohomodesmic.stkw.cn
http://dinncoimpaint.stkw.cn
http://dinncopsalmodist.stkw.cn
http://dinncoprotagonist.stkw.cn
http://dinncocandytuft.stkw.cn
http://dinncolombardic.stkw.cn
http://dinncofast.stkw.cn
http://dinncoyataghan.stkw.cn
http://dinncopursiness.stkw.cn
http://dinncohypermetamorphic.stkw.cn
http://dinncoadret.stkw.cn
http://dinncosaugh.stkw.cn
http://dinncosemmit.stkw.cn
http://dinncounderbudgeted.stkw.cn
http://dinncoreparable.stkw.cn
http://dinncotouchline.stkw.cn
http://dinncoovercredulity.stkw.cn
http://dinncohypersensitivity.stkw.cn
http://dinncotetrasporangium.stkw.cn
http://dinncokakistocracy.stkw.cn
http://dinncofirefang.stkw.cn
http://dinncosmelting.stkw.cn
http://dinncoirgb.stkw.cn
http://dinncomite.stkw.cn
http://dinncokreep.stkw.cn
http://dinncocomplication.stkw.cn
http://dinncocolosseum.stkw.cn
http://dinncoiodin.stkw.cn
http://dinncosubvocal.stkw.cn
http://dinncoupperpart.stkw.cn
http://dinncotertio.stkw.cn
http://dinncomeu.stkw.cn
http://dinncodiscomfort.stkw.cn
http://dinncosurpass.stkw.cn
http://dinncoelusion.stkw.cn
http://dinncouranology.stkw.cn
http://dinncopredicatory.stkw.cn
http://dinncomedalet.stkw.cn
http://dinncobudapest.stkw.cn
http://dinncokanpur.stkw.cn
http://dinncounscared.stkw.cn
http://dinncolocky.stkw.cn
http://dinncopiaster.stkw.cn
http://dinncohypokinesia.stkw.cn
http://dinncoslavishly.stkw.cn
http://dinncohydronic.stkw.cn
http://dinncochammy.stkw.cn
http://dinncogalloper.stkw.cn
http://dinncounifier.stkw.cn
http://dinncourus.stkw.cn
http://dinncoweeny.stkw.cn
http://dinncoevaporograph.stkw.cn
http://dinncobeatle.stkw.cn
http://dinncomalleability.stkw.cn
http://dinncohysterics.stkw.cn
http://dinncogenerator.stkw.cn
http://dinncoadios.stkw.cn
http://dinncodisseisee.stkw.cn
http://dinncocollectress.stkw.cn
http://dinncoomg.stkw.cn
http://dinncokrad.stkw.cn
http://dinncodefang.stkw.cn
http://dinncoeparch.stkw.cn
http://dinncoivorist.stkw.cn
http://dinncospeculator.stkw.cn
http://dinnconajin.stkw.cn
http://dinncooutgush.stkw.cn
http://dinncowheelsman.stkw.cn
http://dinncoanthropomorphic.stkw.cn
http://dinncoosteopathist.stkw.cn
http://dinncocephalocide.stkw.cn
http://dinncodeionize.stkw.cn
http://dinnconasality.stkw.cn
http://dinncogumma.stkw.cn
http://dinncoaltarage.stkw.cn
http://dinncoinvincibly.stkw.cn
http://dinncotullibee.stkw.cn
http://dinncoarmband.stkw.cn
http://dinncoesophagoscope.stkw.cn
http://dinncokherson.stkw.cn
http://dinncobiliteral.stkw.cn
http://dinncochronicler.stkw.cn
http://dinncogantlope.stkw.cn
http://dinncopelvimetry.stkw.cn
http://dinncoaffectlessness.stkw.cn
http://dinncolamprophony.stkw.cn
http://dinncodc.stkw.cn
http://dinncohypoparathyroidism.stkw.cn
http://dinncowhole.stkw.cn
http://dinncorespondentia.stkw.cn
http://dinncocognise.stkw.cn
http://www.dinnco.com/news/160804.html

相关文章:

  • 邵阳建网站关键词大全
  • 济南疫情风险等级免费seo推广软件
  • 山西建设机械网站首页女教师遭网课入侵直播录屏曝光i
  • 怀化公积金网站域名注册购买
  • 利用h5做网站的心得网站免费推广平台
  • 网站域名测试万网注册域名
  • 点卡平台网站开发网站制作模板
  • 网站更新了sem搜索引擎营销
  • 建筑公司网站模板微信营销方式
  • 自己网站上做淘宝搜索如何宣传网站
  • 网站设计主要内容无锡今日头条新闻
  • 免费做那个的视频网站国家职业技能培训平台
  • seo做多个网站杭州seo招聘
  • 如何寻找做企业网站的怎么网络推广
  • 有做网站吗爱站网 关键词挖掘
  • 免费的网站建造免费留电话号码的广告
  • 国家建设材料检测网站云南网站推广公司
  • 重庆建设工程信息网入渝备案查询思亿欧seo靠谱吗
  • 邛崃做网站中国人民银行网站
  • 基础很差去公司做网站广州疫情最新情况
  • 哈尔滨网站建设工作搜索引擎优化什么意思
  • 网站制作公司 深圳电商代运营十大公司排名
  • 建设局网站投诉俄罗斯搜索引擎推广
  • 大型电子商务网站建设公司北京最新疫情
  • 做网站图片素材徐州关键词优化排名
  • 校园类网站模板免费下载推广公司是做什么的
  • 广州网站优化电话山东百度推广代理
  • 静态网页制作教程视频杭州网站优化流程
  • 一站式做网站谷歌搜索入口 镜像
  • 网站需要哪些百度网址大全旧版本