{"id":176968,"date":"2020-10-19T22:01:25","date_gmt":"2020-10-19T14:01:25","guid":{"rendered":"http:\/\/4563.org\/?p=176968"},"modified":"2020-10-19T22:01:25","modified_gmt":"2020-10-19T14:01:25","slug":"%e8%af%b7%e6%95%99%e4%b8%8b-spring-%e5%a4%a7%e4%bd%ac%ef%bc%8c%e5%a6%82%e4%bd%95%e5%81%9a%e6%8c%87%e5%ae%9a%e7%b1%bb%e5%9e%8b-bean-%e7%9a%84%e6%8e%92%e5%ba%8f%e5%92%8c%e7%ad%9b%e9%80%89","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=176968","title":{"rendered":"\u8bf7\u6559\u4e0b Spring \u5927\u4f6c\uff0c\u5982\u4f55\u505a\u6307\u5b9a\u7c7b\u578b Bean \u7684\u6392\u5e8f\u548c\u7b5b\u9009"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8bf7\u6559\u4e0b Spring \u5927\u4f6c\uff0c\u5982\u4f55\u505a\u6307\u5b9a\u7c7b\u578b Bean \u7684\u6392\u5e8f\u548c\u7b5b\u9009               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yuan434356430 <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6211\u505a\u4e86\u4e00\u5957\u8d23\u4efb\u94fe\u6a21\u5f0f\u7684\u6d41\u7a0b\u5904\u7406\uff0c\u5e0c\u671b\u53ef\u4ee5\u81ea\u7531\u7684\u63a7\u5236\u5b50\u7c7b\u7684 Handler \u7684\u987a\u5e8f\u548c\u662f\u5426\u4f7f\u7528\uff0c\u5df2\u7ecf\u5b9e\u73b0\u662f\u5426\u4f7f\u7528\u7684\u90e8\u5206\uff0c\u4f46\u987a\u5e8f\u4ecd\u672a\u5b9e\u73b0\uff0c\u4e14\u76ee\u524d\u7684\u5b9e\u73b0\u65b9\u5f0f\u4e0d\u591f\u4f18\u96c5\u3002 \u6211\u60f3\u76ee\u524d\u7684\u601d\u8def\u662f\u901a\u8fc7\u6570\u636e\u5e93\u914d\u7f6e Handler \u5b50\u7c7b\uff0c\u518d\u5224\u65ad\u662f\u5426\u4f7f\u7528\uff0c\u987a\u5e8f\u901a\u8fc7 Bean \u7684\u547d\u540d\u8fdb\u884c\u6392\u5e8f \u60f3\u901a\u8fc7\u7c7b\u4f3c @Order(21)\u8fd9\u79cd\u65b9\u5f0f\u5b9e\u73b0 Bean \u7684\u6392\u5e8f\u3002\u611f\u8c22~ \u6838\u5fc3\u4ee3\u7801\u5982\u4e0b\uff1a <img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/10\/20201029_5f9ac580db39c.png\" alt=\"\u8bf7\u6559\u4e0b Spring \u5927\u4f6c\uff0c\u5982\u4f55\u505a\u6307\u5b9a\u7c7b\u578b Bean \u7684\u6392\u5e8f\u548c\u7b5b\u9009\" \/><\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>12<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3908064\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : THESDZ <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u5916\u90e8\u6307\u5b9a\u987a\u5e8f\u5427?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3908065\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : THESDZ <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @THESDZ \u6211\u7684\u610f\u601d\u662f,\u4e0d\u8981\u5c40\u9650\u4e8e bean \u521d\u59cb\u5316\u7684\u987a\u5e8f,\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u7b49\u5916\u90e8\u65b9\u5f0f,\u91cd\u65b0\u6392\u5e8f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3908066\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : soulzz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5916\u90e8\u914d\u7f6e\u987a\u5e8f\u57fa\u672c\u6ca1\u6709\u95ee\u9898\uff0c\u6bd5\u7adf\u7c7b\u540d\u4e0d\u5e38\u6539<br \/>\u4f46\u662f\u4e00\u65e6\u6539\u4e86\uff0cide \u53c8\u8ffd\u8e2a\u4e0d\u5230\u5c31\u5bb9\u6613\u51fa\u95ee\u9898                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3908067\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : soulzz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6b63\u5e38\u7684\u60c5\u51b5\u6765\u8bf4\u8fd8\u662f\u8001\u8001\u5b9e\u5b9e\u7684\u5199\u4e2a ChannelInitializer<br \/>\u4e3b\u8fd9\u5957\u8d23\u4efb\u94fe\u6a21\u5f0f\u7684\u6d41\u7a0b\u5904\u7406\u5199\u5b8c\u4e86\u7684\u8bdd\u8bb0\u5f97\u56de\u6211\u4e00\u4e0b\uff0c\u6211\u4e5f\u60f3\u77e5\u9053\u600e\u4e48\u4f18\u96c5\u7684\u89e3\u51b3\u6bd4\u8f83\u597d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3908068\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : yuan434356430 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u80af\u5b9a\u8981\u4f7f\u7528\u5916\u90e8\u65b9\u5f0f\u6392\u5e8f\u4e86\uff0c\u4e1a\u52a1\u9700\u8981\uff0c\u5b58\u5230 Mysql \u7136\u540e\u5237\u5230 Redis \u7f13\u5b58\uff0c\u6bcf\u6b21\u90fd\u8bfb\u7f13\u5b58\u521d\u59cb\u5316\u94fe                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3908069\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : skypyb <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ca1\u592a\u770b\u660e\u767d\uff0c \u6392\u5e8f\u5b8c\u4e4b\u540e\u8fd8\u80fd\u52a8\u6001\u4fee\u6539\u5417\uff1f \u4ec5\u9650\u6392\u5e8f\u7684\u8bdd\u5b9e\u73b0 InitializingBean\uff0c \u5728 afterPropertiesSet()\u91cc\u8fb9\u6392\u5e8f\u5c31\u884c\u4e86<br \/>\u8981\u80fd\u5728\u5916\u90e8\u64cd\u4f5c\u52a8\u6001\u6392\u5e8f\u7684\u8bdd\uff0c \u90a3\u8d23\u4efb\u94fe\u4e0a\u4e0b\u6587\u80af\u5b9a\u5f97\u5bf9\u5916\u66b4\u9732\u8c03\u6574\u987a\u5e8f\u7684 API \u624d\u884c= =                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3908070\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tamer <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u6bb5\u65f6\u95f4\u6ca1\u5199\u8fd9\u4e9b\u4e86, \u81ea\u5b9a\u4e49\u6ce8\u89e3\u5b9a\u4e49 enable,order \u653e\u5230\u4f18\u5148\u7ea7\u961f\u5217\u5904\u7406?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3908071\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : haosamax <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             private static void sortPostProcessors(List&lt;?&gt; postProcessors, ConfigurableListableBeanFactory beanFactory) {<br \/> \/\/ Nothing to sort?<br \/> if (postProcessors.size() &lt;= 1) {<br \/> return;<br \/> }<br \/> Comparator&lt;Object&gt; comparatorToUse = null;<br \/> if (beanFactory instanceof DefaultListableBeanFactory) {<br \/> comparatorToUse = ((DefaultListableBeanFactory) beanFactory).getDependencyComparator();<br \/> }<br \/> if (comparatorToUse == null) {<br \/> comparatorToUse = OrderComparator.INSTANCE;<br \/> }<br \/> postProcessors.sort(comparatorToUse);<br \/> }                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3908072\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : THESDZ <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @soulzz #3 \u4e0d\u89c1\u5f97\u975e\u662f\u7c7b\u540d,\u57fa\u672c\u540d\u79f0\u4e5f\u53ef\u4ee5\u91cd\u65b0\u547d\u540d.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3908073\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Cbdy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             org.springframework.core.annotation.AnnotationAwareOrderComparator                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3908074\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Bromine0x23 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528 ObjectProvider \u83b7\u53d6\u6240\u6709 bean\uff0c\u518d\u8fdb\u884c\u6392\u5e8f\u6bd4\u8f83\u597d\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3908075\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mingmingtiexue <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u77e5\u9053\u6211\u6709\u6ca1\u6709\u7406\u89e3 \u4f60\u7684\u610f\u601d\u3002<br \/>\u4f7f\u7528 zk\uff0c \u8282\u70b9\u662f \u9700\u8981\u7684 bean \u7684\u540d\u5b57\u9017\u53f7\u5206\u5272\uff0c\u8d4b\u7ed9\u4e00\u4e2a\u53d8\u91cf\u3002<br \/>\u540c\u65f6\u89e3\u51b3\u4e86\u662f\u5426\u7528\u548c\u987a\u5e8f\u95ee\u9898\uff0c\u5305\u542b\u540d\u5b57\u5c31\u662f\u7528\uff0c \u6392\u5e8f\u5c31\u662f handler \u6267\u884c\u987a\u5e8f\u3002<br \/>\u4e0d\u8fc7\u9700\u8981\u5f15\u5165 zk \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u6559\u4e0b Spring \u5927\u4f6c\uff0c\u5982\u4f55\u505a&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\/176968"}],"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=176968"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/176968\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=176968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=176968"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=176968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}