{"id":1036,"date":"2024-11-13T21:25:48","date_gmt":"2024-11-13T13:25:48","guid":{"rendered":"https:\/\/www.coffecat.cn\/?p=1036"},"modified":"2024-11-13T21:25:48","modified_gmt":"2024-11-13T13:25:48","slug":"springboot%e9%9b%86%e6%88%90swagger%e6%8e%a5%e5%8f%a3%e6%96%87%e6%a1%a3%e8%b8%a9%e5%9d%91%e8%ae%b0%e5%bd%95","status":"publish","type":"post","link":"https:\/\/www.coffecat.cn\/index.php\/2024\/11\/13\/springboot%e9%9b%86%e6%88%90swagger%e6%8e%a5%e5%8f%a3%e6%96%87%e6%a1%a3%e8%b8%a9%e5%9d%91%e8%ae%b0%e5%bd%95\/","title":{"rendered":"springboot\u96c6\u6210swagger\u63a5\u53e3\u6587\u6863\u8e29\u5751\u8bb0\u5f55"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u8d77\u56e0\uff1a\u56e0\u4e3a\u81ea\u5df1\u5728\u505a\u7684\u540e\u7aef\u9879\u76ee\u4e2d\u6ca1\u6709swagger\u63a5\u53e3\u6587\u6863\uff0c\u6240\u4ee5\u60f3\u96c6\u6210\u4e00\u4e0b\uff0c\u540e\u9762\u53ef\u80fd\u4f1a\u7528\u5230\uff0c\u5f53\u6211\u6839\u636e\u96c6\u6210\u64cd\u4f5c\u6307\u5357\u8fdb\u884c\u96c6\u6210\u65f6\u53d1\u73b0\u5728\u542f\u52a8\u9879\u76ee\u65f6\u4f1a\u62a5\u9519\uff0c\u62a5\u9519\u4fe1\u606f\u5982\u4e0b<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"Failed to start bean \u2018documentationPluginsBootstrapper\u2019; nested exception is java.lang.NullPointerException\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #88C0D0\">Failed<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">to<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">start<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">bean<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">\u2018documentationPluginsBootstrapper\u2019<\/span><span style=\"color: #81A1C1\">;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">nested<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">exception<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">is<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">java.lang.NullPointerException<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u610f\u601d\u662f\u8bf4\u5728springboot\u542f\u52a8\u65f6\u5728\u5bb9\u5668\u4e2d\u6ca1\u6709\u52a0\u8f7d\u5230\u8fd9\u4e2abean\u5bfc\u81f4npe<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u7f51\u4e0a\u67e5\u4e86\u4e00\u4e0b\u8bf4\u662fspringboot\u7248\u672c\u95ee\u9898\uff0c\u7531\u4e8espringboot\u7248\u672c\u8fc7\u9ad8\u5bfc\u81f4\u4e0eswagger\u4e0d\u517c\u5bb9\uff0c\u4e8e\u662f\u5c31\u6539\u4e86\u4e00\u4e0bspringboot\u7684\u7248\u672c\uff0c\u4ece\u76ee\u524d\u4f7f\u7528\u76842.6.13\u6539\u6210\u4e862.3.0\uff0c\u7ed3\u679c\u53d1\u73b0mysql\u542f\u52a8\u5668\u5c31\u8ddf\u7740\u62a5\u9519\u4e86\uff0c\u5f53\u6539\u6210\u5408\u9002\u7684mysql\u7248\u672c\u540e\u53d1\u73b0\u8fde\u63a5\u6c60\u62a5\u9519\uff0c\u8fd9\u4e2a\u65b9\u6cd5\u5c31\u653e\u5f03\u4e86\uff0c\u5982\u679c\u76f4\u63a5\u4fee\u6539springboot\u7248\u672c\u4f1a\u5bfc\u81f4\u4e00\u8fde\u4e32\u7684\u95ee\u9898\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;spring-boot.version&gt;2.6.13&lt;\/spring-boot.version&gt;\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">&lt;spring-boot.version&gt;<\/span><span style=\"color: #D8DEE9FF\">2.6.13<\/span><span style=\"color: #81A1C1\">&lt;\/spring-boot.version&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e8e\u662f\u5c31\u6539\u4e86swagger\u7684\u7248\u672c\uff0c\u4ece\u539f\u6765\u76842.9.2\u6539\u6210\u4e863.0.0\uff0c\u7136\u540e\u91cd\u542f\u9879\u76ee\uff0c\u53d1\u73b0\u4f9d\u65e7\u62a5\u76f8\u540c\u7684\u9519\u8bef<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;dependency&gt;\n    &lt;groupId&gt;io.springfox&lt;\/groupId&gt;\n    &lt;artifactId&gt;springfox-swagger2&lt;\/artifactId&gt;\n    &lt;version&gt;2.9.2&lt;\/version&gt;\n&lt;\/dependency&gt;\n&lt;dependency&gt;\n    &lt;groupId&gt;io.springfox&lt;\/groupId&gt;\n    &lt;artifactId&gt;springfox-swagger-ui&lt;\/artifactId&gt;\n    &lt;version&gt;2.9.2&lt;\/version&gt;\n&lt;\/dependency&gt;\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">&lt;dependency&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">&lt;groupId&gt;<\/span><span style=\"color: #D8DEE9FF\">io.springfox<\/span><span style=\"color: #81A1C1\">&lt;\/groupId&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">&lt;artifactId&gt;<\/span><span style=\"color: #D8DEE9FF\">springfox-swagger2<\/span><span style=\"color: #81A1C1\">&lt;\/artifactId&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">&lt;version&gt;<\/span><span style=\"color: #D8DEE9FF\">2.9.2<\/span><span style=\"color: #81A1C1\">&lt;\/version&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">&lt;\/dependency&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">&lt;dependency&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">&lt;groupId&gt;<\/span><span style=\"color: #D8DEE9FF\">io.springfox<\/span><span style=\"color: #81A1C1\">&lt;\/groupId&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">&lt;artifactId&gt;<\/span><span style=\"color: #D8DEE9FF\">springfox-swagger-ui<\/span><span style=\"color: #81A1C1\">&lt;\/artifactId&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">&lt;version&gt;<\/span><span style=\"color: #D8DEE9FF\">2.9.2<\/span><span style=\"color: #81A1C1\">&lt;\/version&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">&lt;\/dependency&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e8e\u662f\u53c8\u641c\u7d22\u4e86\u4e00\u4e0b\uff0c\u5728\u4e00\u4e2a\u535a\u4e3b\u7684\u6587\u7ae0\u4e2d\u63d0\u5230springboot2.6\u7684\u7248\u672c\u95ee\u9898\uff0c\u6e90git\u5730\u5740\uff1a\u3010<a href=\"https:\/\/github.com\/springfox\/springfox\/issues\/3462\">Spring 5.3\/Spring Boot 2.4 \u652f\u6301 \u00b7\u95ee\u9898 #3462 \u00b7springfox\/springfox \u00b7GitHub\u7684<\/a>\u3011<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"708\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-1024x708.png\" alt=\"\" class=\"wp-image-1042\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-1024x708.png 1024w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-300x208.png 300w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-768x531.png 768w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image.png 1353w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-1-1024x300.png\" alt=\"\" class=\"wp-image-1043\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-1-1024x300.png 1024w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-1-300x88.png 300w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-1-768x225.png 768w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-1.png 1347w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u4ee5\u5177\u4f53\u539f\u56e0\u5e94\u8be5\u662f\u56e0\u4e3aspringboot\u7248\u672c\u539f\u56e0\u5bfc\u81f4\u7684\uff0c\u56e0\u4e3aSpringfox\u4f7f\u7528\u7684\u8def\u5f84\u5339\u914d\u662f\u57fa\u4e8eAntPathMatcher\u7684\uff0c\u800cSpring Boot 2.6.X\u4f7f\u7528\u7684\u662fPathPatternMatcher\uff0c\u6240\u4ee5\u6211\u5728yml\u4e2d\u8c03\u6574\u4e86matching-strategy\uff0c\u6539\u4e3a\u4e86<em>ANT_PATH_MATCHER<\/em><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"  # \u5728\u4e0eswagger\u96c6\u6210\u65f6\u7531\u4e8espringboot\u7248\u672c\u539f\u56e0\u5bfc\u81f4\u65e0\u6cd5\u52a0\u8f7dbean\n  # Springfox\u4f7f\u7528\u7684\u8def\u5f84\u5339\u914d\u662f\u57fa\u4e8eAntPathMatcher\u7684\uff0c\u800cSpring Boot 2.6.X\u4f7f\u7528\u7684\u662fPathPatternMatcher\n  mvc:\n    pathmatch:\n      matching-strategy: ANT_PATH_MATCHER\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">  <\/span><span style=\"color: #616E88\"># \u5728\u4e0eswagger\u96c6\u6210\u65f6\u7531\u4e8espringboot\u7248\u672c\u539f\u56e0\u5bfc\u81f4\u65e0\u6cd5\u52a0\u8f7dbean<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">  <\/span><span style=\"color: #616E88\"># Springfox\u4f7f\u7528\u7684\u8def\u5f84\u5339\u914d\u662f\u57fa\u4e8eAntPathMatcher\u7684\uff0c\u800cSpring Boot 2.6.X\u4f7f\u7528\u7684\u662fPathPatternMatcher<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #8FBCBB\">mvc<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #8FBCBB\">pathmatch<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #8FBCBB\">matching-strategy<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">ANT_PATH_MATCHER<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u6539\u5b8c\u540e\u91cd\u542f\u9879\u76ee\uff0c\u53d1\u73b0\u6211\u7684\u9879\u76ee\u8fd8\u662f\u5b58\u5728\u76f8\u540c\u7684\u95ee\u9898\uff0c\u540e\u6765\u5c31\u6ca1\u5728\u4f7f\u7528swagger2\u8fdb\u884c\u96c6\u6210\uff0c\u6539\u7528\u4e86Knife4j\uff0c\u96c6\u6210\u8fc7\u7a0b\u5f88\u987a\u5229\uff0c\u4e0eswagger2\u4e00\u6837\u7b80\u5355\uff08\u672c\u6765\u5c31\u662f\u5bf9swagger\u7684\u589e\u5f3a\uff09\uff0c\u96c6\u6210\u540e\u91cd\u542f\u6ca1\u6709\u62a5\u9519\u3002\u4e0b\u9762\u662f\u6574\u7406\u96c6\u6210\u8fc7\u7a0b\uff1a<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color has-link-color wp-elements-87be6b73d6094da238f251d670355c66 wp-block-paragraph\">\u6ce8\uff1a\u7531\u4e8e\u6211\u7684\u9879\u76ee\u662f\u4f7f\u7528\u7684springboot2.6.3\u7684\u7248\u672c\u5b58\u5728\u7248\u672c\u95ee\u9898\uff0c\u5982\u679c\u57282.6.x\u4e4b\u524d\u7684\u7248\u672c\uff0c\u53ef\u80fd\u4e0d\u4f1a\u7528\u7c7b\u4f3c\u7684\u95ee\u9898<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u8fd9\u91cc\u4f7f\u7528\u7684\u662f\u65e7\u7248\u672c\u7684\uff082.0.9\uff09knife4j\uff0c\u5b98\u65b9\u6587\u6863\u5730\u5740\uff1a\u3010<a href=\"https:\/\/doc.xiaominfo.com\/v2\/\">knife4j (xiaominfo.com)<\/a>\u3011<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\u5f15\u5165\u4f9d\u8d56\uff1a<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;dependency&gt;\n    &lt;groupId&gt;com.github.xiaoymin&lt;\/groupId&gt;\n    &lt;artifactId&gt;knife4j-spring-boot-starter&lt;\/artifactId&gt;\n    &lt;!--\u5728\u5f15\u7528\u65f6\u8bf7\u5728maven\u4e2d\u592e\u4ed3\u5e93\u641c\u7d222.X\u6700\u65b0\u7248\u672c\u53f7--&gt;\n    &lt;version&gt;2.0.9&lt;\/version&gt;\n&lt;\/dependency&gt;\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">&lt;dependency&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">&lt;groupId&gt;<\/span><span style=\"color: #D8DEE9FF\">com.github.xiaoymin<\/span><span style=\"color: #81A1C1\">&lt;\/groupId&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">&lt;artifactId&gt;<\/span><span style=\"color: #D8DEE9FF\">knife4j-spring-boot-starter<\/span><span style=\"color: #81A1C1\">&lt;\/artifactId&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #616E88\">&lt;!--\u5728\u5f15\u7528\u65f6\u8bf7\u5728maven\u4e2d\u592e\u4ed3\u5e93\u641c\u7d222.X\u6700\u65b0\u7248\u672c\u53f7--&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">&lt;version&gt;<\/span><span style=\"color: #D8DEE9FF\">2.0.9<\/span><span style=\"color: #81A1C1\">&lt;\/version&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">&lt;\/dependency&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06matching-strategy\u914d\u7f6e\u4e3aANT_PATH_MATCHER<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"  # \u5728\u4e0eswagger\u96c6\u6210\u65f6\u7531\u4e8espringboot\u7248\u672c\u539f\u56e0\u5bfc\u81f4\u65e0\u6cd5\u52a0\u8f7dbean\n  # Springfox\u4f7f\u7528\u7684\u8def\u5f84\u5339\u914d\u662f\u57fa\u4e8eAntPathMatcher\u7684\uff0c\u800cSpring Boot 2.6.X\u4f7f\u7528\u7684\u662fPathPatternMatcher\n  mvc:\n    pathmatch:\n      matching-strategy: ANT_PATH_MATCHER\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">  <\/span><span style=\"color: #616E88\"># \u5728\u4e0eswagger\u96c6\u6210\u65f6\u7531\u4e8espringboot\u7248\u672c\u539f\u56e0\u5bfc\u81f4\u65e0\u6cd5\u52a0\u8f7dbean<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">  <\/span><span style=\"color: #616E88\"># Springfox\u4f7f\u7528\u7684\u8def\u5f84\u5339\u914d\u662f\u57fa\u4e8eAntPathMatcher\u7684\uff0c\u800cSpring Boot 2.6.X\u4f7f\u7528\u7684\u662fPathPatternMatcher<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #8FBCBB\">mvc<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #8FBCBB\">pathmatch<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #8FBCBB\">matching-strategy<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">ANT_PATH_MATCHER<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u521b\u5efaSwagger\u914d\u7f6e\u4f9d\u8d56\uff0c\u8fd9\u91cc\u662f\u5b98\u7f51\u7248\u672c\uff0c\u4e5f\u53ef\u4ee5\u5c06apiInfo\u5355\u72ec\u5199\u4e00\u4e2a\u65b9\u6cd5\uff0c\u8fd9\u91cc\u4f7f\u7528\u7684\u6ce8\u89e3\u5c31\u4e0d\u518d\u662f@EnableSwagger2\u4e86\u800c\u6539\u4e3a\u4e86@EnableSwagger2WebMvc<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"@Configuration\n@EnableSwagger2WebMvc\npublic class Knife4jConfiguration {\n\n    @Bean(value = &quot;defaultApi2&quot;)\n    public Docket defaultApi2() {\n        Docket docket=new Docket(DocumentationType.SWAGGER_2)\n                .apiInfo(new ApiInfoBuilder()\n                        \/\/.title(&quot;swagger-bootstrap-ui-demo RESTful APIs&quot;)\n                        .description(&quot;# swagger-bootstrap-ui-demo RESTful APIs&quot;)\n                        .termsOfServiceUrl(&quot;http:\/\/www.xx.com\/&quot;)\n                        .contact(&quot;xx@qq.com&quot;)\n                        .version(&quot;1.0&quot;)\n                        .build())\n                \/\/\u5206\u7ec4\u540d\u79f0\n                .groupName(&quot;2.X\u7248\u672c&quot;)\n                .select()\n                \/\/\u8fd9\u91cc\u6307\u5b9aController\u626b\u63cf\u5305\u8def\u5f84\n                .apis(RequestHandlerSelectors.basePackage(&quot;com.github.xiaoymin.knife4j.controller&quot;))\n                .paths(PathSelectors.any())\n                .build();\n        return docket;\n    }\n}\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">Configuration<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">EnableSwagger2WebMvc<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">public<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">class<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">Knife4jConfiguration<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">Bean<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">value<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">defaultApi2<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">public<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">Docket<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">defaultApi2<\/span><span style=\"color: #ECEFF4\">()<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #8FBCBB\">Docket<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">docket<\/span><span style=\"color: #81A1C1\">=new<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">Docket<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">DocumentationType<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">SWAGGER_2<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">apiInfo<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">new<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">ApiInfoBuilder<\/span><span style=\"color: #ECEFF4\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">                        <\/span><span style=\"color: #616E88\">\/\/.title(&quot;swagger-bootstrap-ui-demo RESTful APIs&quot;)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">description<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\"># swagger-bootstrap-ui-demo RESTful APIs<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">termsOfServiceUrl<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">http:\/\/www.xx.com\/<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">contact<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">xx@qq.com<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">version<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">1.0<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                        <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">build<\/span><span style=\"color: #ECEFF4\">())<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">                <\/span><span style=\"color: #616E88\">\/\/\u5206\u7ec4\u540d\u79f0<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">groupName<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">2.X\u7248\u672c<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">select<\/span><span style=\"color: #ECEFF4\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">                <\/span><span style=\"color: #616E88\">\/\/\u8fd9\u91cc\u6307\u5b9aController\u626b\u63cf\u5305\u8def\u5f84<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">apis<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">RequestHandlerSelectors<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">basePackage<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">com.github.xiaoymin.knife4j.controller<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">paths<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">PathSelectors<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">any<\/span><span style=\"color: #ECEFF4\">())<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                <\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">build<\/span><span style=\"color: #ECEFF4\">()<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> docket<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e4b\u540e\u5c31\u662f\u6b63\u5e38\u7f16\u5199\u63a5\u53e3\uff0c\u5728\u63a5\u53e3\u65b9\u6cd5\u4e0a\u6dfb\u52a0@Api\u6ce8\u89e3\u4e0e@ApiOperation\u6ce8\u89e3\uff0c\u5728\u6ce8\u89e3\u4e2d\u914d\u7f6e\u63a5\u53e3\u7684\u63cf\u8ff0\u7b49\u4fe1\u606f\uff08\u5b98\u7f51\u793a\u4f8b\uff09<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"@Api(tags = &quot;\u9996\u9875\u6a21\u5757&quot;)\n@RestController\npublic class IndexController {\n\n    @ApiImplicitParam(name = &quot;name&quot;,value = &quot;\u59d3\u540d&quot;,required = true)\n    @ApiOperation(value = &quot;\u5411\u5ba2\u4eba\u95ee\u597d&quot;)\n    @GetMapping(&quot;\/sayHi&quot;)\n    public ResponseEntity&lt;String&gt; sayHi(@RequestParam(value = &quot;name&quot;)String name){\n        return ResponseEntity.ok(&quot;Hi:&quot;+name);\n    }\n}\n\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">Api<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">tags<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u9996\u9875\u6a21\u5757<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">RestController<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">public<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">class<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">IndexController<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">ApiImplicitParam<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">name<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">name<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9\">value<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u59d3\u540d<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9\">required<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">true<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">ApiOperation<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">value<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u5411\u5ba2\u4eba\u95ee\u597d<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">@<\/span><span style=\"color: #D08770\">GetMapping<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\/sayHi<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">public<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">ResponseEntity<\/span><span style=\"color: #ECEFF4\">&lt;<\/span><span style=\"color: #8FBCBB\">String<\/span><span style=\"color: #ECEFF4\">&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">sayHi<\/span><span style=\"color: #ECEFF4\">(@<\/span><span style=\"color: #D08770\">RequestParam<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">value<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">name<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #8FBCBB\">String<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">name<\/span><span style=\"color: #ECEFF4\">){<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">ResponseEntity<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">ok<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Hi:<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #D8DEE9FF\">name<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u91cd\u542f\u9879\u76ee\uff0c\u8bbf\u95ee\uff1a<code>http:\/\/localhost(ip):xxx(port)\/doc.html<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"471\" src=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-2-1024x471.png\" alt=\"\" class=\"wp-image-1050\" srcset=\"https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-2-1024x471.png 1024w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-2-300x138.png 300w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-2-768x353.png 768w, https:\/\/www.coffecat.cn\/wp-content\/uploads\/2024\/11\/image-2.png 1366w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u8d77\u56e0\uff1a\u56e0\u4e3a\u81ea\u5df1\u5728\u505a\u7684\u540e\u7aef\u9879\u76ee\u4e2d\u6ca1\u6709swagger\u63a5\u53e3\u6587\u6863\uff0c\u6240\u4ee5\u60f3\u96c6\u6210\u4e00\u4e0b\uff0c\u540e\u9762\u53ef\u80fd\u4f1a\u7528\u5230\uff0c\u5f53\u6211\u6839\u636e\u96c6\u6210\u64cd\u4f5c\u6307\u5357 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.coffecat.cn\/index.php\/2024\/11\/13\/springboot%e9%9b%86%e6%88%90swagger%e6%8e%a5%e5%8f%a3%e6%96%87%e6%a1%a3%e8%b8%a9%e5%9d%91%e8%ae%b0%e5%bd%95\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cspringboot\u96c6\u6210swagger\u63a5\u53e3\u6587\u6863\u8e29\u5751\u8bb0\u5f55\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,6],"tags":[],"class_list":["post-1036","post","type-post","status-publish","format-standard","hentry","category-uncategorized","category-scatteredtechnicalpoints"],"views":1332,"_links":{"self":[{"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/posts\/1036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1036"}],"version-history":[{"count":12,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/posts\/1036\/revisions"}],"predecessor-version":[{"id":1051,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/posts\/1036\/revisions\/1051"}],"wp:attachment":[{"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.coffecat.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}