-
前言:这两天公司新开了个项目,组长对项目进行了总体规划,其中提到引入Swagger,私下研究了一下基于knife4j增强的Swagger3.0.0(其实就是美化了一下页面),很多文章都说引入很简单,而且基本都是三个步骤引依赖,创建配置类,启动项目看效果,我跟着操作了一番,结过嘎嘎报错,所以写篇文章记录一下。
-
技术栈:springboot 2.6.4+knife4j-spring-boot-statter3.0.3
-
1、引入依赖
gradle格式:
"com.github.xiaoymin:knife4j-spring-boot-starter:3.0.3"。
-
2、初始化配置
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.oas.annotatio

最低0.47元/天 解锁文章
1566





