{"id":6760,"date":"2024-11-14T11:58:09","date_gmt":"2024-11-14T03:58:09","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6760\/"},"modified":"2024-11-14T11:58:09","modified_gmt":"2024-11-14T03:58:09","slug":"springboot%e9%a1%b9%e7%9b%ae%e9%85%8d%e7%bd%aedruid%e7%9b%91%e6%8e%a7%ef%bc%8c%e4%b8%ba%e4%bb%80%e4%b9%88%e8%ae%bf%e9%97%ae%e6%97%b6%e4%bb%8d%e6%8a%a5404%e9%94%99%e8%af%af%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6760\/","title":{"rendered":"SpringBoot\u9879\u76ee\u914d\u7f6eDruid\u76d1\u63a7\uff0c\u4e3a\u4ec0\u4e48\u8bbf\u95ee\u65f6\u4ecd\u62a5404\u9519\u8bef\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/172990458479823.jpg\" class=\"aligncenter\" title=\"SpringBoot\u9879\u76ee\u914d\u7f6eDruid\u76d1\u63a7\uff0c\u4e3a\u4ec0\u4e48\u8bbf\u95ee\u65f6\u4ecd\u62a5404\u9519\u8bef\uff1f\u63d2\u56fe\" alt=\"SpringBoot\u9879\u76ee\u914d\u7f6eDruid\u76d1\u63a7\uff0c\u4e3a\u4ec0\u4e48\u8bbf\u95ee\u65f6\u4ecd\u62a5404\u9519\u8bef\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>springboot\u9879\u76ee\uff0cdruid\u914d\u7f6e\u4e86\u540e\u53f0\u76d1\u63a7\uff0c\u5982\u4e0b\u56fe\uff0c\u4e3a\u4ec0\u4e48\u8bbf\u95ee\u7684\u65f6\u5019\u8fd8\u662f\u62a5404\uff1f<\/strong><\/p>\n<p>\u4f60\u5728pom.xml\u6587\u4ef6\u4e2d\u914d\u7f6e\u4e86druid\u7684filter\u548cservlet\uff0c\u8fd8\u914d\u7f6e\u4e86\u76d1\u63a7\u8def\u5f84&#8221;\/druid\/*&#8221;\uff0c\u4f46\u662f\u8bbf\u95ee\u7684\u65f6\u5019\u8fd8\u662f\u62a5404\u9519\u8bef\u3002\u8fd9\u662f\u56e0\u4e3a\u4f60\u9700\u8981\u5728springboot\u4e3b\u542f\u52a8\u7c7b\u4e0a\u6dfb\u52a0@servletcomponentscan\u6ce8\u89e3\uff0c\u4ee5\u4fbfspringboot\u626b\u63cf\u5e76\u6ce8\u518cdruid\u7684filter\u548cservlet\u3002<\/p>\n<pre>@SpringBootApplication\n@ServletComponentScan\npublic class Application {\n\n    public static void main(String[] args) {\n        SpringApplication.run(Application.class, args);\n    }\n\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6dfb\u52a0\u4e86\u8fd9\u4e2a\u6ce8\u89e3\u540e\uff0c\u91cd\u65b0\u8fd0\u884c\u9879\u76ee\uff0c\u5c31\u53ef\u4ee5\u8bbf\u95eedruid\u7684\u540e\u53f0\u76d1\u63a7\u4e86\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fSpringBoot\u9879\u76ee\u914d\u7f6eDruid\u76d1\u63a7\uff0c\u4e3a\u4ec0\u4e48\u8bbf\u95ee\u65f6\u4ecd\u62a5404\u9519\u8bef\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>springboot\u9879\u76ee\uff0cdruid\u914d\u7f6e\u4e86\u540e\u53f0\u76d1\u63a7\uff0c\u5982\u4e0b\u56fe\uff0c\u4e3a\u4ec0\u4e48\u8bbf\u95ee\u7684\u65f6\u5019\u8fd8\u662f\u62a5404\uff1f \u4f60\u5728pom.xml\u6587\u4ef6\u4e2d\u914d\u7f6e\u4e86druid\u7684filter\u548cservlet\uff0c\u8fd8\u914d\u7f6e\u4e86\u76d1\u63a7\u8def\u5f84&#8221;\/druid\/*&#8221;\uff0c\u4f46\u662f\u8bbf\u95ee\u7684\u65f6\u5019\u8fd8\u662f\u62a5404\u9519\u8bef\u3002\u8fd9\u662f\u56e0\u4e3a\u4f60\u9700\u8981\u5728springboot\u4e3b\u542f\u52a8\u7c7b\u4e0a\u6dfb\u52a0@servletcomponentscan\u6ce8\u89e3\uff0c\u4ee5\u4fbfspringboot\u626b\u63cf\u5e76\u6ce8\u518cdruid\u7684filter\u548cservlet\u3002 @SpringBootApplication @ServletComponentScan public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } \u767b\u5f55\u540e\u590d\u5236 \u6dfb\u52a0\u4e86\u8fd9\u4e2a\u6ce8\u89e3\u540e\uff0c\u91cd\u65b0\u8fd0\u884c\u9879\u76ee\uff0c\u5c31\u53ef\u4ee5\u8bbf\u95eedruid\u7684\u540e\u53f0\u76d1\u63a7\u4e86\u3002 \u4ee5\u4e0a\u5c31\u662fSpringBoot\u9879\u76ee\u914d\u7f6eDruid\u76d1\u63a7\uff0c\u4e3a\u4ec0\u4e48\u8bbf\u95ee\u65f6\u4ecd\u62a5404\u9519\u8bef\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6760","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=6760"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6760\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}