{"id":714,"date":"2023-10-31T09:01:01","date_gmt":"2023-10-31T01:01:01","guid":{"rendered":""},"modified":"2023-10-31T09:01:01","modified_gmt":"2023-10-31T01:01:01","slug":"knife4j\u63a5\u53e3\u6587\u6863\u5de5\u5177\u7684\u4f7f\u7528","status":"publish","type":"post","link":"https:\/\/mushiming.com\/714.html","title":{"rendered":"knife4j\u63a5\u53e3\u6587\u6863\u5de5\u5177\u7684\u4f7f\u7528"},"content":{"rendered":"
\u5de5\u5177\u5177\u4f53\u529f\u80fd\u5c31\u4e0d\u591a\u89e3\u91ca\u4e86\uff0c\u76f4\u63a5\u6b65\u5165\u4e3b\u9898<\/p>\n
\u5bfc\u5165\u76f8\u5173\u4f9d\u8d56<\/p>\n
<dependency><\/span>\n <groupId>com.github.xiaoymin<\/groupId><\/span>\n <artifactId>knife4j-spring-boot-starter<\/artifactId><\/span>\n <version>3.0.3<\/version><\/span>\n<\/dependency><\/span>\n<\/code><\/pre>\n\u7136\u540e\u5728config\u6587\u4ef6\u5939\u91cc\u521b\u5efaSwaggerConfig\u7c7b\uff08\u540d\u79f0\u4e0d\u56fa\u5b9a\u53ea\u662f\u4e3a\u4e86\u65b9\u4fbf\u8bc6\u522b\u529f\u80fd\uff09<\/p>\n
package<\/span> com.example.demo.config;\n\nimport<\/span> com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;\nimport<\/span> org.springframework.context.annotation.Bean;\nimport<\/span> org.springframework.context.annotation.Configuration;\nimport<\/span> springfox.documentation.builders.ApiInfoBuilder;\nimport<\/span> springfox.documentation.builders.PathSelectors;\nimport<\/span> springfox.documentation.builders.RequestHandlerSelectors;\nimport<\/span> springfox.documentation.oas.annotations.EnableOpenApi;\nimport<\/span> springfox.documentation.service.Contact;\nimport<\/span> springfox.documentation.spi.DocumentationType;\nimport<\/span> springfox.documentation.spring.web.plugins.Docket;\nimport<\/span> springfox.documentation.swagger2.annotations.EnableSwagger2;\n\n