1、单体项目集成
- 添加依赖:
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.29</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.3.1</version> </dependency> <dependency> <groupId>com.github.xiaoymin</groupId> <artifactId>knife4j-spring-boot-starter</artifactId> <version>3.0.3</version> </dependency>
- 编写配置类:
/** * @CreateTime: 2023-10-14 15:33 * @Description: 接口文档配置 * @Version: 1.0 */ @Configuration @EnableSwagger2 public class Knife4jConfiguration { @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2)