Spring Boot 集成knife4j

Spring Boot 2集成knife4j

官方文档

Knife4j的前身是swagger-bootstrap-ui,前身swagger-bootstrap-ui是一个纯swagger-uiui皮肤项目

一开始项目初衷是为了写一个增强版本的swagger的前端ui,但是随着项目的发展,面对越来越多的个性化需求,不得不编写后端Java代码以满足新的需求,在swagger-bootstrap-ui的1.8.5~1.9.6版本之间,采用的是后端Java代码和Ui都混合在一个Jar包里面的方式提供给开发者使用.这种方式虽说对于集成swagger来说很方便,只需要引入jar包即可,但是在微服务架构下显得有些臃肿。

引入依赖
        <!-- Spring Boot 集成 knife4j swagger -->
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>knife4j-spring-boot-starter</artifactId>
            <version>3.0.2</version>
        </dependency>
yml配置文件
knife4j:
  enable: true
  openapi:
    title: "内容管理系统"
    description: "内容系统管理系统对课程相关信息进行业务管理数据"
    # aaa"
    email: xxxxxx@outlook.com
    concat: bgu
    url: https://docs.xxxxxx.com
    version: v1.0.0
    license: Apache 2.0
    license-url: "https://xxxxxx.com/"
    terms-of-service-url: "https://xxxxxx.com/"
    group:
      test1:
        group-name: "内容管理系统"
        api-rule: package
        api-rule-resources:
          - com.xxx.content
#  basic:
#    password: admin
#    username: admin
报错

Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException

加@EnableWebMvc注解

spring:
  mvc:
    pathmatch: #Swagger相关
      matching-strategy: ant_path_matcher
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值