{"id":11863,"date":"2023-11-28T22:36:22","date_gmt":"2023-11-28T14:36:22","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=11863"},"modified":"2023-12-11T14:34:27","modified_gmt":"2023-12-11T06:34:27","slug":"spring-zhonga0p-xiang-guan-shu-yu-you-na-xie","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/spring-zhonga0p-xiang-guan-shu-yu-you-na-xie\/","title":{"rendered":"Spring\u4e2dA0P\u76f8\u5173\u672f\u8bed\u6709\u54ea\u4e9b\uff1f"},"content":{"rendered":"<p>\u5728Spring\u4e2d\uff0c\u4e0eAOP\uff08Aspect-Oriented Programming\uff09\u76f8\u5173\u7684\u672f\u8bed\u5305\u62ec\u4ee5\u4e0b\u51e0\u4e2a\uff1a<\/p>\n<ol>\n<li>\n<strong>\u5207\u9762\uff08Aspect\uff09\uff1a<\/strong><\/p>\n<ul>\n<li>\u5207\u9762\u662f\u4e00\u7ec4\u5173\u4e8e\u6a2a\u5207\u5173\u6ce8\u70b9\u7684\u884c\u4e3a\uff0c\u5305\u62ec\u5207\u70b9\u548c\u901a\u77e5\u3002\u5207\u9762\u5b9a\u4e49\u4e86\u5728\u4f55\u5904\u3001\u4f55\u65f6\u6267\u884c\u6a2a\u5207\u903b\u8f91\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u5207\u70b9\uff08Pointcut\uff09\uff1a<\/strong><\/p>\n<ul>\n<li>\u5207\u70b9\u662f\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u5177\u4f53\u4f4d\u7f6e\uff0c\u5b9a\u4e49\u4e86\u5728\u4f55\u5904\u5e94\u7528\u5207\u9762\u7684\u6a2a\u5207\u903b\u8f91\u3002\u901a\u5e38\uff0c\u5207\u70b9\u662f\u901a\u8fc7\u8868\u8fbe\u5f0f\u6216\u6a21\u5f0f\u6765\u5b9a\u4e49\u7684\uff0c\u7528\u4e8e\u5339\u914d\u7279\u5b9a\u7684\u8fde\u63a5\u70b9\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u901a\u77e5\uff08Advice\uff09\uff1a<\/strong><\/p>\n<ul>\n<li>\u901a\u77e5\u662f\u5207\u9762\u4e2d\u7684\u5177\u4f53\u884c\u4e3a\uff0c\u5b9a\u4e49\u4e86\u5728\u5207\u70b9\u4f55\u65f6\u6267\u884c\u7684\u6a2a\u5207\u903b\u8f91\u3002Spring\u652f\u6301\u4e0d\u540c\u7c7b\u578b\u7684\u901a\u77e5\uff0c\u5305\u62ec\u524d\u7f6e\u901a\u77e5\uff08Before advice\uff09\u3001\u540e\u7f6e\u901a\u77e5\uff08After advice\uff09\u3001\u73af\u7ed5\u901a\u77e5\uff08Around advice\uff09\u3001\u8fd4\u56de\u901a\u77e5\uff08After returning advice\uff09\u548c\u5f02\u5e38\u901a\u77e5\uff08After throwing advice\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u8fde\u63a5\u70b9\uff08Join Point\uff09\uff1a<\/strong><\/p>\n<ul>\n<li>\u8fde\u63a5\u70b9\u662f\u5728\u5e94\u7528\u7a0b\u5e8f\u6267\u884c\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u63d2\u5165\u5207\u9762\u7684\u70b9\u3002\u901a\u5e38\uff0c\u8fde\u63a5\u70b9\u662f\u65b9\u6cd5\u7684\u8c03\u7528\u3001\u5f02\u5e38\u7684\u629b\u51fa\u7b49\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u5f15\u5165\uff08Introduction\uff09\uff1a<\/strong><\/p>\n<ul>\n<li>\u5f15\u5165\u5141\u8bb8\u4e00\u4e2a\u5207\u9762\u5411\u4e00\u4e2a\u73b0\u6709\u7684\u7c7b\u6dfb\u52a0\u65b0\u7684\u65b9\u6cd5\u548c\u5c5e\u6027\u3002\u8fd9\u6837\u53ef\u4ee5\u5728\u4e0d\u4fee\u6539\u539f\u59cb\u7c7b\u7684\u60c5\u51b5\u4e0b\u5f15\u5165\u65b0\u7684\u884c\u4e3a\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u7ec7\u5165\uff08Weaving\uff09\uff1a<\/strong><\/p>\n<ul>\n<li>\u7ec7\u5165\u662f\u5c06\u5207\u9762\u5e94\u7528\u5230\u76ee\u6807\u5bf9\u8c61\u4ee5\u521b\u5efa\u65b0\u7684\u4ee3\u7406\u5bf9\u8c61\u7684\u8fc7\u7a0b\u3002Spring\u652f\u6301\u7f16\u8bd1\u65f6\u7ec7\u5165\u3001\u7c7b\u52a0\u8f7d\u65f6\u7ec7\u5165\u548c\u8fd0\u884c\u65f6\u7ec7\u5165\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u76ee\u6807\u5bf9\u8c61\uff08Target Object\uff09\uff1a<\/strong><\/p>\n<ul>\n<li>\u76ee\u6807\u5bf9\u8c61\u662f\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5b9e\u9645\u6267\u884c\u4e1a\u52a1\u903b\u8f91\u7684\u5bf9\u8c61\u3002\u5728AOP\u4e2d\uff0c\u5207\u9762\u901a\u8fc7\u7ec7\u5165\u7684\u65b9\u5f0f\u5f71\u54cd\u76ee\u6807\u5bf9\u8c61\u7684\u884c\u4e3a\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u4ee3\u7406\u5bf9\u8c61\uff08Proxy Object\uff09\uff1a<\/strong><\/p>\n<ul>\n<li>\u4ee3\u7406\u5bf9\u8c61\u662f\u5305\u542b\u4e86\u5207\u9762\u7684\u76ee\u6807\u5bf9\u8c61\u7684\u65b0\u5bf9\u8c61\u3002\u5f53\u8c03\u7528\u4ee3\u7406\u5bf9\u8c61\u7684\u65b9\u6cd5\u65f6\uff0c\u4f1a\u6267\u884c\u7ec7\u5165\u7684\u5207\u9762\u903b\u8f91\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u8fd9\u4e9b\u672f\u8bed\u5171\u540c\u6784\u6210\u4e86Spring\u4e2dAOP\u7684\u57fa\u672c\u6982\u5ff5\u548c\u5b9e\u73b0\u673a\u5236\u3002\u901a\u8fc7\u4f7f\u7528\u8fd9\u4e9b\u672f\u8bed\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u66f4\u597d\u5730\u7406\u89e3\u548c\u4f7f\u7528AOP\u6765\u5b9e\u73b0\u6a2a\u5207\u5173\u6ce8\u70b9\u7684\u6a21\u5757\u5316\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Spring\u4e2d\uff0c\u4e0eAOP\uff08Aspect-Oriented Programming\uff09\u76f8\u5173\u7684\u672f\u8bed\u5305\u62ec\u4ee5\u4e0b\u51e0\u4e2a\uff1a  [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[121],"tags":[],"class_list":["post-11863","post","type-post","status-publish","format-standard","hentry","category-spring"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/11863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=11863"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/11863\/revisions"}],"predecessor-version":[{"id":37196,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/11863\/revisions\/37196"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=11863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=11863"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=11863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}