\u63a5\u53e3\u5730\u5740<\/strong><\/div>\n3.0 \u4e2d\u7684\u63a5\u53e3\u5730\u5740\u4e5f\u548c\u4e4b\u524d\u6709\u6240\u4e0d\u540c\uff0c\u4ee5\u524d\u5728 2.9.2 \u4e2d\u6211\u4eec\u4e3b\u8981\u8bbf\u95ee\u4e24\u4e2a\u5730\u5740\uff1a<\/p>\n
\u6587\u6863\u63a5\u53e3\u5730\u5740\uff1ahttp:\/\/localhost:8080\/v2\/api-docs
\n\u6587\u6863\u9875\u9762\u5730\u5740\uff1ahttp:\/\/localhost:8080\/swagger-ui.html
\n\u73b0\u5728\u5728 3.0 \u4e2d\uff0c\u8fd9\u4e24\u4e2a\u5730\u5740\u4e5f\u53d1\u751f\u4e86\u53d8\u5316\uff1a<\/p>\n
\u6587\u6863\u63a5\u53e3\u5730\u5740\uff1ahttp:\/\/localhost:8080\/v3\/api-docs
\n\u6587\u6863\u9875\u9762\u5730\u5740\uff1ahttp:\/\/localhost:8080\/swagger-ui\/index.html
\n\u7279\u522b\u662f\u6587\u6863\u9875\u9762\u5730\u5740\uff0c\u5982\u679c\u7528\u4e86 3.0\uff0c\u800c\u53bb\u8bbf\u95ee\u4e4b\u524d\u7684\u9875\u9762\uff0c\u4f1a\u62a5 404\u3002<\/p>\n
\u6ce8\u89e3\u65e7\u7684\u6ce8\u89e3\u8fd8\u53ef\u4ee5\u7ee7\u7eed\u4f7f\u7528\uff0c\u4e0d\u8fc7\u5728 3.0 \u4e2d\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5176\u4ed6\u6ce8\u89e3\u3002<\/p>\n
\u4f8b\u5982\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 @EnableOpenApi \u4ee3\u66ff\u4ee5\u524d\u65e7\u7248\u672c\u4e2d\u7684 @EnableSwagger2\u3002<\/p>\n
\u8bdd\u662f\u8fd9\u4e48\u8bf4\uff0c\u4e0d\u8fc7\u677e\u54e5\u5728\u5b9e\u9645\u4f53\u9a8c\u4e2d\uff0c\u611f\u89c9 @EnableOpenApi \u6ce8\u89e3\u7684\u529f\u80fd\u4e0d\u660e\u663e\uff0c\u52a0\u4e0d\u52a0\u90fd\u884c\u3002\u7ffb\u4e86\u4e0b\u6e90\u7801\uff0c@EnableOpenApi \u6ce8\u89e3\u4e3b\u8981\u529f\u80fd\u662f\u4e3a\u4e86\u5bfc\u5165 OpenApiDocumentationConfiguration \u914d\u7f6e\u7c7b\uff0c\u5982\u4e0b\uff1a<\/p>\n
\r\n@Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) \r\n@Target(value = {java.lang.annotation.ElementType.TYPE}) \r\n@Documented \r\n@Import(OpenApiDocumentationConfiguration.class) \r\npublic @interface EnableOpenApi { \r\n} \r\n<\/pre>\n\u7136\u540e\u6211\u53c8\u770b\u4e86\u4e0b\u81ea\u52a8\u5316\u914d\u7f6e\u7c7b OpenApiAutoConfiguration\uff0c\u5982\u4e0b\uff1a<\/p>\n
\r\n@Configuration \r\n@EnableConfigurationProperties(SpringfoxConfigurationProperties.class) \r\n@ConditionalOnProperty(value = \"springfox.documentation.enabled\", havingValue = \"true\", matchIfMissing = true) \r\n@Import({ \r\n OpenApiDocumentationConfiguration.class, \r\n SpringDataRestConfiguration.class, \r\n BeanValidatorPluginsConfiguration.class, \r\n Swagger2DocumentationConfiguration.class, \r\n SwaggerUiWebFluxConfiguration.class, \r\n SwaggerUiWebMvcConfiguration.class \r\n}) \r\n@AutoConfigureAfter({ WebMvcAutoConfiguration.class, JacksonAutoConfiguration.class, \r\n HttpMessageConvertersAutoConfiguration.class, RepositoryRestMvcAutoConfiguration.class }) \r\npublic class OpenApiAutoConfiguration { \r\n \r\n} \r\n<\/pre>\n\u53ef\u4ee5\u770b\u5230\uff0c\u81ea\u52a8\u5316\u914d\u7f6e\u7c7b\u91cc\u8fb9\u4e5f\u5bfc\u5165\u4e86 OpenApiDocumentationConfiguration\u3002<\/p>\n
\u6240\u4ee5\u5728\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u5b9e\u9645\u4e0a\u4e0d\u9700\u8981\u6dfb\u52a0 @EnableOpenApi \u6ce8\u89e3\u3002<\/p>\n
\u6839\u636e OpenApiAutoConfiguration \u4e0a\u7684 @ConditionalOnProperty \u6761\u4ef6\u6ce8\u89e3\u4e2d\u7684\u5b9a\u4e49\uff0c\u6211\u4eec\u53d1\u73b0\uff0c\u5982\u679c\u5728 application.properties \u4e2d\u8bbe\u7f6e springfox.documentation.enabled=false\uff0c\u5373\u5173\u95ed\u4e86 swagger \u529f\u80fd\uff0c\u6b64\u65f6\u81ea\u52a8\u5316\u914d\u7f6e\u7c7b\u5c31\u4e0d\u6267\u884c\u4e86\uff0c\u8fd9\u4e2a\u65f6\u5019\u53ef\u4ee5\u901a\u8fc7 @EnableOpenApi \u6ce8\u89e3\u5bfc\u5165 OpenApiDocumentationConfiguration \u914d\u7f6e\u7c7b\u3002\u6280\u672f\u4e0a\u6765\u8bf4\u903b\u8f91\u662f\u8fd9\u6837\uff0c\u4e0d\u8fc7\u5e94\u7528\u4e2d\u6682\u672a\u53d1\u73b0\u8fd9\u6837\u7684\u9700\u6c42(\u5373\u5728 application.properties \u4e2d\u5173\u95ed swagger\uff0c\u518d\u901a\u8fc7 @EnableOpenApi \u6ce8\u89e3\u5f00\u542f)\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u5728\u793e\u533a\u7684\u63a8\u52a8\u4e0b\uff0cSpringfox3.0 \u53bb\u5e74 7 \u6708\u4efd\u5c31\u53d1\u5e03\u4e86\uff0c\u6700\u8fd1\u7ec8\u4e8e\u5f97\u7a7a\u548c\u5c0f\u4f19\u4f34\u4eec\u804a\u4e00\u804a\u65b0\u7248\u672c\u7684\u65b0\u53d8\u5316\u3002 […]<\/p>\n","protected":false},"author":1898,"featured_media":210908,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[654],"class_list":["post-210902","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread","tag-swagger3-0"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/210902","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1898"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=210902"}],"version-history":[{"count":11,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/210902\/revisions"}],"predecessor-version":[{"id":211166,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/210902\/revisions\/211166"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/210908"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=210902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=210902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=210902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}