{"id":6866,"date":"2024-11-14T15:20:50","date_gmt":"2024-11-14T07:20:50","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6866\/"},"modified":"2024-11-14T15:20:50","modified_gmt":"2024-11-14T07:20:50","slug":"springmvc-%e8%bf%9e%e6%8e%a5-mysql-%e5%a4%b1%e8%b4%a5%e6%97%b6%e5%a6%82%e4%bd%95%e8%8e%b7%e5%8f%96%e9%94%99%e8%af%af%e4%bf%a1%e6%81%af%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6866\/","title":{"rendered":"SpringMVC \u8fde\u63a5 MySQL \u5931\u8d25\u65f6\u5982\u4f55\u83b7\u53d6\u9519\u8bef\u4fe1\u606f\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173000054575910.jpg\" class=\"aligncenter\" title=\"SpringMVC \u8fde\u63a5 MySQL \u5931\u8d25\u65f6\u5982\u4f55\u83b7\u53d6\u9519\u8bef\u4fe1\u606f\uff1f\u63d2\u56fe\" alt=\"SpringMVC \u8fde\u63a5 MySQL \u5931\u8d25\u65f6\u5982\u4f55\u83b7\u53d6\u9519\u8bef\u4fe1\u606f\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>SpringMVC \u8fde\u63a5 MySQL \u65f6\u906d\u9047\u9519\u8bef\u7684\u89e3\u51b3\u65b9\u6cd5<\/strong><\/p>\n<p>\u5728 SpringMVC \u9879\u76ee\u4e2d\uff0c\u8fde\u63a5 MySQL \u6570\u636e\u5e93\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\u3002\u4f8b\u5982\uff0c\u6545\u610f\u5c06 MySQL \u540d\u79f0\u5199\u9519\u4e3a\u201cmysq\u201d\u540e\u518d\u91cd\u65b0\u542f\u52a8\u5de5\u7a0b\uff0c\u4f1a\u53d1\u73b0 Tomcat \u542f\u52a8\u4fe1\u606f\u59cb\u7ec8\u505c\u6ede\u3002\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u4e00\u79cd\u65b9\u6cd5\u662f\u8bbe\u7f6e\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\u3002\u5982\u679c\u5728 5 \u79d2\u5185\u65e0\u6cd5\u83b7\u53d6\u8fde\u63a5\uff0c\u5c31\u4f1a\u8f93\u51fa\u9519\u8bef\u4fe1\u606f\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u4e0d\u5b58\u5728\u4e4b\u7c7b\u7684\u3002<\/p>\n<p>\u9664\u4e86\u8bbe\u7f6e\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\u5728\u542f\u52a8\u65f6\u8f93\u51fa\u9519\u8bef\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u4f7f\u7528 datasource.getConnection \u6267\u884c\u4e00\u6b21\u4f1a\u62a5\u9519\u3002\u53ef\u4ee5\u901a\u8fc7 init-method\u3001@PostConstruct \u6216\u5b9e\u73b0 InitializingBean \u63a5\u53e3\u6765\u62a5\u9519\u3002\u4e5f\u53ef\u4ee5\u4f7f\u7528\u963f\u91cc\u63d0\u4f9b\u7684 Druid \u6570\u636e\u6e90\uff0c\u5b83\u5e94\u8be5\u4f1a\u5728\u542f\u52a8\u65f6\u62a5\u9519\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fSpringMVC \u8fde\u63a5 MySQL \u5931\u8d25\u65f6\u5982\u4f55\u83b7\u53d6\u9519\u8bef\u4fe1\u606f\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>SpringMVC \u8fde\u63a5 MySQL \u65f6\u906d\u9047\u9519\u8bef\u7684\u89e3\u51b3\u65b9\u6cd5 \u5728 SpringMVC \u9879\u76ee\u4e2d\uff0c\u8fde\u63a5 MySQL \u6570\u636e\u5e93\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\u3002\u4f8b\u5982\uff0c\u6545\u610f\u5c06 MySQL \u540d\u79f0\u5199\u9519\u4e3a\u201cmysq\u201d\u540e\u518d\u91cd\u65b0\u542f\u52a8\u5de5\u7a0b\uff0c\u4f1a\u53d1\u73b0 Tomcat \u542f\u52a8\u4fe1\u606f\u59cb\u7ec8\u505c\u6ede\u3002\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u4e00\u79cd\u65b9\u6cd5\u662f\u8bbe\u7f6e\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\u3002\u5982\u679c\u5728 5 \u79d2\u5185\u65e0\u6cd5\u83b7\u53d6\u8fde\u63a5\uff0c\u5c31\u4f1a\u8f93\u51fa\u9519\u8bef\u4fe1\u606f\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u4e0d\u5b58\u5728\u4e4b\u7c7b\u7684\u3002 \u9664\u4e86\u8bbe\u7f6e\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\u5728\u542f\u52a8\u65f6\u8f93\u51fa\u9519\u8bef\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u4f7f\u7528 datasource.getConnection \u6267\u884c\u4e00\u6b21\u4f1a\u62a5\u9519\u3002\u53ef\u4ee5\u901a\u8fc7 init-method\u3001@PostConstruct \u6216\u5b9e\u73b0 InitializingBean \u63a5\u53e3\u6765\u62a5\u9519\u3002\u4e5f\u53ef\u4ee5\u4f7f\u7528\u963f\u91cc\u63d0\u4f9b\u7684 Druid \u6570\u636e\u6e90\uff0c\u5b83\u5e94\u8be5\u4f1a\u5728\u542f\u52a8\u65f6\u62a5\u9519\u3002 \u4ee5\u4e0a\u5c31\u662fSpringMVC \u8fde\u63a5 MySQL \u5931\u8d25\u65f6\u5982\u4f55\u83b7\u53d6\u9519\u8bef\u4fe1\u606f\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-6866","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6866","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=6866"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6866\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6866"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6866"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6866"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}