????????springboot升级到3后之前的knife4j配置就要变了一下了
<dependency>
????????<groupId>com.github.xiaoymin</groupId>
????????<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>? ? ? ? <version>4.1.0</version>
</dependency>
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class Knife4jConfig {
@Bean
public OpenAPI springShopOpenAPI() {
return new OpenAPI()
// 接口文档标题
.info(
new Info().title("接口文档")
// 接口文档简介
.description("Knife4j OpenApi3的接口文档")
// 接口文档版本
.version("v1.0")
// 开发者联系方式
.contact(new Contact().name("").email(""))
);
}
}
@Tag(name = "首页")
public class HomeController {
@Data
@Schema(name = "XXX")
public class XXXVO{
@Id
@Schema(name = "")
private Integer id ;
/** 父级id */
@Schema(name = "父级id")
private Integer pid ;
}