{"id":225449,"date":"2020-12-04T14:30:07","date_gmt":"2020-12-04T06:30:07","guid":{"rendered":"http:\/\/4563.org\/?p=225449"},"modified":"2020-12-04T14:30:07","modified_gmt":"2020-12-04T06:30:07","slug":"maven-%e4%be%9d%e8%b5%96%e5%a6%82%e4%bd%95%e5%8f%aa%e5%bc%95%e5%85%a5%e8%80%8c%e4%b8%8d%e4%bd%bf%e7%94%a8%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=225449","title":{"rendered":"maven \u4f9d\u8d56\u5982\u4f55\u53ea\u5f15\u5165\u800c\u4e0d\u4f7f\u7528\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  maven \u4f9d\u8d56\u5982\u4f55\u53ea\u5f15\u5165\u800c\u4e0d\u4f7f\u7528\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lrvinye <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>RT,\u6bd4\u5982\u8bf4 \u6211\u60f3\u5728\u9879\u76ee\u7684 core \u5305\u4e2d, \u5c01\u88c5 SpringContextHolder \u8fd9\u6837\u4e00\u4e2a\u64cd\u4f5c springbean \u7684\u5de5\u5177\u7c7b\uff0c \u7528\u6765\u5728\u9879\u76ee\u7684\u591a\u4e2a springboot \u5e94\u7528\u4e2d\u5f15\u5165 core \u4f9d\u8d56\uff0c \u7136\u540e\u4f7f\u7528 SpringContextHolder \u7b49\u5176\u5b83\u5c01\u88c5\u597d\u7684\u516c\u5171\u7c7b\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u5728\u7f16\u5199 SpringContextHolder \u7684\u65f6\u5019\u53c8\u9700\u8981\u5f15\u5165 springboot \u7684\u4f9d\u8d56 \uff08\u4e0d\u7136\u6ca1\u6709 ApplicationContextAware \u8fd9\u6837\u7684\u63a5\u53e3\u7c7b&#8230;\u4e4b\u7c7b\u7684\u95ee\u9898\uff09<\/p>\n<p>\u6240\u6709\u6211\u7684\u95ee\u9898\u662f\u5982\u4f55\u5728 core \u7684 pom \u91cc\u9762\u5f15\u5165 springboot \u7684\u4f9d\u8d56\uff0c \u800c\u4e0d\u4f7f\u7528\uff08\u56e0\u4e3a core \u4e0d\u662f\u4e2a\u5e94\u7528\uff0c\u53ea\u662f\u7f16\u5199\u4e86\u4e00\u4e9b\u516c\u5171\u7c7b\uff09\uff0c \u6211\u77e5\u9053\u76f4\u63a5\u5f15\u5165\u8dd1\u8d77\u6765\u4e5f\u6ca1\u95ee\u9898\uff0c \u4f46\u662f\u4e3b\u8981\u662f\u4e3a\u4e86\u8ba9 core \u4e0d\u90a3\u4e48\u91cd\u3002<\/p>\n<p>\u662f\u4f7f\u7528&lt;scope&gt;\uff1f\u6216\u8005&lt;optional&gt;?<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4559039\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : codingadog <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             scope compile                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4559040\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liuxey <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8bf7\u4f7f\u7528\uff1a<br \/>&lt;scope&gt;provided&lt;\/scope&gt;<\/p>\n<p>\u5b98\u65b9\u7684\u89e3\u91ca\uff1a<br \/>This scope is used to mark dependencies that should be provided at runtime by JDK or a container, hence the name.<\/p>\n<p>ref: https:\/\/maven.apache.org\/guides\/introduction\/introduction-to-dependency-mechanism.html#Dependency_Scope                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4559041\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : daimubai <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             scope                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>maven \u4f9d\u8d56\u5982\u4f55\u53ea\u5f15\u5165\u800c\u4e0d\u4f7f\u7528&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/225449"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=225449"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/225449\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=225449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=225449"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=225449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}