{"id":1014,"date":"2025-04-22T06:00:13","date_gmt":"2025-04-21T22:00:13","guid":{"rendered":"https:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/"},"modified":"2025-04-22T06:00:13","modified_gmt":"2025-04-21T22:00:13","slug":"%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f","status":"publish","type":"post","link":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/","title":{"rendered":"\u7528AspectJ\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f"},"content":{"rendered":"<div class=\"article_content clearfix\" id=\"article_content\">\n <link href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/editerView\/kdoc_html_views-1a98987dfd.css\" rel=\"stylesheet\"\/>\n <link href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/editerView\/ck_htmledit_views-704d5b9767.css\" rel=\"stylesheet\"\/>\n<div class=\"htmledit_views\" id=\"content_views\">\n  <iframe loading=\"lazy\" align=\"top\" frameborder=\"0\" height=\"90\" scrolling=\"no\" src=\"http:\/\/www.zealware.com\/csdnblog01.html\" width=\"728\"><br \/>\n  <\/iframe><\/p>\n<div class=\"postText\">\n<div>\n    \u7531\u4e8eSpring2\u7684AOP\u90e8\u5206\u4f5c\u4e86\u6bd4\u8f83\u5927\u7684\u8c03\u6574\uff0c\u5f88\u591a\u5730\u65b9\u7684\u4f7f\u7528\u5f15\u5165\u4e86AspectJ\u4e2d\u7684\u5185\u5bb9\uff0c\u4e3a\u4e86\u5b8c\u6210\u300a\u6df1\u5165Spring 2\uff1a\u8f7b\u91cf\u7ea7J2EE\u5f00\u53d1\u6846\u67b6\u539f\u7406\u4e0e\u5b9e\u8df5\u300b\u4e2dSpring AOP\u5e94\u7528\u4e00\u7ae0\u7684\u5199\u4f5c\uff0c\u56e0\u6b64\u8fd9\u4e24\u5929\u628aAspectJ\u7814\u7a76\u4e86\u4e00\u4e0b\uff0c\u91cd\u8bfb\u4e86\u4e00\u6b21\u300aAspectJ in action\u300b\uff0c\u53d7\u76ca\u4e0d\u5c11\u3002\u8fd9\u91cc\u662f\u4eca\u5929\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u620f\u793a\u4f8b\uff1a\n   <\/div>\n<div>\n    \u8fd9\u4e2a\u793a\u4f8b\u4e2d\u6709\u4e00\u4e2a\u8bbe\u8ba1\u4e86\u4e00\u4e2a\u6218\u58ebSoldier\u7c7b\uff0c\u8fd9\u4e2a\u7c7b\u5177\u6709\u4e00\u4e9b\u968f\u673a\u529f\u80fd\uff0c\u5305\u62ec\u53d1\u52a8\u653b\u51fb\u3001\u6cbb\u7597\u3001\u8eb2\u907f\u3001\u79fb\u52a8\u7b49\u529f\u80fd\u3002\u53e6\u5916\u6709\u4e00\u4e2a\u7b80\u5355\u7684\u4e3b\u7a0b\u5e8fMainTest\uff0c\u91cc\u9762\u7684\u529f\u80fd\u5c31\u662f\u8ba9\u4e24\u4e2a\u6218\u58eb\u56de\u5408\u5236\u4e92\u76f8\u653b\u51fb\u3002\u53e6\u5916\u6709\u4e00\u4e2a\u5207\u9762\uff0c\u662f\u7528\u6765\u89c2\u5bdf\u5e76\u8f93\u5165\u6218\u6597\u7684\u8be6\u7ec6\u8fc7\u7a0b\uff0c\u76f4\u5230\u4e00\u4e2a\u88ab\u6253\u5012\u4e0b\uff1a\n   <\/div>\n<div>\n   <\/div>\n<div>\n    \u5148\u770b\u6218\u58ebSoldier\u7684\u4ee3\u7801\uff1a\n   <\/div>\n<p>\n    package springroad.demo.chap5.aspectj;\n   <\/p>\n<p>\n    public class Soldier {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    private String name;<br \/>\n    <br \/>\n    private int health=100;<br \/>\n    <br \/>\n    private int damage=10;<br \/>\n    <br \/>\n    private int x=10;<br \/>\n    <br \/>\n    private int y=10;<br \/>\n    <br \/>\n    public boolean attack(Soldier target){<br \/>\n    <!-- --><br \/>\n    <br \/>\n    boolean ret=false;<br \/>\n    <br \/>\n    if(!target.dodge())<br \/>\n    <br \/>\n    {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    target.setHealth(target.getHealth()-this.damage);<br \/>\n    <br \/>\n    ret=true;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    move();<br \/>\n    <br \/>\n    treat();<br \/>\n    <br \/>\n    return ret;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    public void move()<br \/>\n    <br \/>\n    {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    this.x+=getRandom(5);<br \/>\n    <br \/>\n    this.y+=getRandom(5);<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    \/\/\u8eb2\u907fx\u53cay\u968f\u673a\u53d8\u52a8\uff0c\u6210\u529f\u7387\u4e3a50%<br \/>\n    <br \/>\n    public boolean dodge()<br \/>\n    <br \/>\n    {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    return getRandom(10)%2==0;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    \/\/\u6cbb\u7597\uff0c\u5177\u6709\u4e00\u5b9a\u6210\u529f\u7684\u673a\u4f1a\uff0c\u53ef\u4ee5\u63d0\u9ad8\u751f\u547d\u503c0-20\u70b9<br \/>\n    <br \/>\n    public void treat()<br \/>\n    <br \/>\n    {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    if(canTreat())<br \/>\n    <br \/>\n    this.health+=getRandom(20);<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    public boolean canTreat()<br \/>\n    <br \/>\n    {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    return getRandom(10)\/2==0;<br \/>\n    <br \/>\n    }\n   <\/p>\n<p>\n    private int getRandom(int seed)<br \/>\n    <br \/>\n    {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    return RandomUtil.getRandomValue(seed);<br \/>\n    <br \/>\n    }\n   <\/p>\n<p>\n    \/\/getter\u53casetter\u65b9\u6cd5<br \/>\n    <br \/>\n    public int getHealth() {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    return health;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    public void setHealth(int health) {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    this.health = health;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    public String getName() {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    return name;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    public void setName(String name) {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    this.name = name;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    public int getX() {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    return x;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    public void setX(int x) {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    this.x = x;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    public int getY() {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    return y;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    public void setY(int y) {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    this.y = y;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    public int getDamage() {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    return damage;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    public void setDamage(int damage) {<br \/>\n    <!-- --><br \/>\n    <br \/>\n    this.damage = damage;<br \/>\n    <br \/>\n    }\n   <\/p>\n<p>\n    }\n   <\/p>\n<div>\n   <\/div>\n<div>\n   <\/div>\n<div>\n   <\/div>\n<div>\n    \u518d\u770b\u770bMainTest.java\u4e2d\u6218\u573a\u6a21\u62df\u7684\u4ee3\u7801(\u5373\u4e3b\u7a0b\u5e8f\uff09\uff1a\n   <\/div>\n<div>\n    package springroad.demo.chap5.aspectj;<br \/>\n    <br \/>\n    public class MainTest {<br \/>\n    <br \/>\n    public static void main(String[] args) {<br \/>\n    <br \/>\n    Soldier p1=new Soldier();<br \/>\n    <br \/>\n    p1.setName(&#8220;\u89d2\u8272\uff11&#8221;);<br \/>\n    <br \/>\n    Soldier p2=new Soldier();<br \/>\n    <br \/>\n    p2.setName(&#8220;\u89d2\u8272\uff12&#8221;);<br \/>\n    <br \/>\n    int i=0;<br \/>\n    <br \/>\n    while(p1.getHealth()&gt;0 &amp;&amp; p2.getHealth()&gt;0)<br \/>\n    <br \/>\n    {<br \/>\n    <br \/>\n    p2.attack(p1);<br \/>\n    <br \/>\n    p1.attack(p2);<br \/>\n    <br \/>\n    i+=2;<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    System.out.println(&#8220;\u6218\u6597\u6b21\u6570\uff1a&#8221;+i);<br \/>\n    <br \/>\n    if(p1.getHealth()&gt;0)System.out.println(p1.getName()+&#8221;\u6218\u80dc!&#8221;);<br \/>\n    <br \/>\n    else System.out.println(p2.getName()+&#8221;\u6218\u80dc!&#8221;);<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    }\n   <\/div>\n<div>\n   <\/div>\n<div>\n    \u968f\u673a\u6570\u751f\u6210\u5668\uff08\u6982\u7387\u4ea7\u751f)\n   <\/div>\n<div>\n    package springroad.demo.chap5.aspectj;\n   <\/div>\n<div>\n    public class RandomUtil {<br \/>\n    <br \/>\n    private static java.util.Random random=new java.util.Random();<br \/>\n    <br \/>\n    public static int getRandomValue(int seed)<br \/>\n    <br \/>\n    {<br \/>\n    <br \/>\n    return random.nextInt(seed);<br \/>\n    <br \/>\n    }<br \/>\n    <br \/>\n    }\n   <\/div>\n<div>\n   <\/div>\n<div>\n    \u8fd9\u4e0a\u9762\u4e09\u4e2a\u7a0b\u5e8f\u662f\u5b8c\u6574\u7684\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528javac\u7f16\u8bd1\uff0c\u7136\u540e\u6267\u884cMainTest\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u7ecf\u8fc7\u4e00\u5c0f\u6bb5\u65f6\u95f4\u6218\u6597\u540e\u5206\u51fa\u80dc\u8d1f\u540e\uff0c\u4f1a\u663e\u793a\u51fa\u6218\u6597\u7684\u6b21\u6570\u53ca\u80dc\u8d1f\u60c5\u51b5\u3002\n   <\/div>\n<div>\n    \u4e3a\u4e86\u8981\u80fd\u89c2\u5bdf\u6574\u4e2a\u6218\u6597\u7684\u8be6\u7ec6\u8fc7\u7a0b\uff0c\u8fd9\u91cc\u5728\u4e0d\u6539\u52a8\u4e0a\u9762\u7684\u7a0b\u5e8f\u4ee3\u7801\u7684\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528AspectJ\u505a\u4e86\u4e00\u4e2a\u5207\u9762\uff0c\u4e3b\u8981\u7528\u6765\u8f93\u51fa\u653b\u51fb\u7684\u60c5\u51b5\u3002\n   <\/div>\n<div>\n<div>\n    <\/div>\n<div>\n     \u5207\u9762RecordGame.aj\u7684\u4ee3\u7801\u5982\u4e0b \uff1a\n    <\/div>\n<div>\n    <\/div>\n<div>\n     package springroad.demo.chap5.aspectj;<br \/>\n     <br \/>\n     public aspect RecordGame {<br \/>\n     <br \/>\n     private static java.text.SimpleDateFormat df=new java.text.SimpleDateFormat(&#8220;yyyy-MM-dd H:m:s&#8221;);<br \/>\n     <br \/>\n     pointcut doRecord():execution(boolean Soldier.attack(Soldier));<br \/>\n     <br \/>\n     pointcut\u00a0 supperRole(Soldier s): target(s)&amp;&amp;execution(boolean Soldier.canTreat());<br \/>\n     <br \/>\n     after() returning(boolean value) :doRecord()<br \/>\n     <br \/>\n     {<br \/>\n     <br \/>\n     Soldier s=(Soldier)thisJoinPoint.getTarget();<br \/>\n     <br \/>\n     Soldier t=(Soldier)thisJoinPoint.getArgs()[0];<br \/>\n     <br \/>\n     System.out.println(df.format(new java.util.Date())+&#8221;:&#8221;+s.getName()+&#8221;\u3000\u5411\u3000&#8221;+t.getName()+&#8221;\u3000\u53d1\u52a8\u4e86\u4e00\u6b21\u653b\u51fb!\uff0d\uff0d\u7ed3\u679c\uff1a&#8221;+(value?&#8221;\u6210\u529f&#8221;:&#8221;\u5931\u8d25&#8221;));<br \/>\n     <br \/>\n     System.out.println(s.getName()+&#8221;\u751f\u547d\u503c\uff1a&#8221;+s.getHealth()+&#8221;;&#8221;+t.getName()+&#8221;\u751f\u547d\u503c:&#8221;+t.getHealth());<br \/>\n     <br \/>\n     }<br \/>\n     <br \/>\n     after(Soldier s)returning(boolean value):target(s)&amp;&amp;call(boolean Soldier.canTreat())<br \/>\n     <br \/>\n     {<br \/>\n     <br \/>\n     if(value)System.out.println(s.getName()+&#8221;\u5f97\u5230\u6cbb\u7597\uff01&#8221;);<br \/>\n     <br \/>\n     }<br \/>\n     <br \/>\n     boolean around(Soldier s): supperRole(s)<br \/>\n     <br \/>\n     {<br \/>\n     <br \/>\n     if(&#8220;super&#8221;.equals(s.getName())) return true;<br \/>\n     <br \/>\n     else return proceed(s);<br \/>\n     <br \/>\n     }<br \/>\n     <br \/>\n     }\n    <\/div>\n<div>\n    <\/div>\n<div>\n     \u4f7f\u7528ajt\u7f16\u8bd1\u4e0a\u9762\u7684\u56db\u4e2a\u6587\u4ef6\uff0c\u5728\u547d\u4ee4\u884c\u8f93\u5165\u5982\u4e0b\u6240\u793a\u547d\u4ee4\uff08\u8981\u6c42AspectJ\u6b63\u786e\u5b89\u88c5\u53ca\u914d\u7f6e)\uff1a\n    <\/div>\n<div>\n     ajc springroad\/demo\/chap5\/*.*j*\n    <\/div>\n<div>\n    <\/div>\n<div>\n     \u7136\u540e\u518d\u4f7f\u7528java \u547d\u4ee4\u6267\u884cMainTest\u5373\u53ef\u4ee5\u770b\u5230\u975e\u5e38\u6709\u8da3\u7684\u7ed3\u679c\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff1a\n    <\/div>\n<div>\n    <\/div>\n<div>\n    <\/div>\n<\/p><\/div>\n<div>\n   <\/div>\n<p id=\"TBPingURL\">\n    Trackback: http:\/\/tb.blog.csdn.net\/TrackBack.aspx?PostId=1347028\n   <\/p>\n<p>\n  <\/div>\n<\/p><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u7531\u4e8eSpring2\u7684AOP\u90e8\u5206\u4f5c\u4e86\u6bd4\u8f83\u5927\u7684\u8c03\u6574\uff0c\u5f88\u591a\u5730\u65b9\u7684\u4f7f\u7528\u5f15\u5165\u4e86AspectJ\u4e2d\u7684\u5185\u5bb9\uff0c\u4e3a\u4e86\u5b8c\u6210\u300a\u6df1\u5165Sp [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":215,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-1014","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-32"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7528AspectJ\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/\u7528aspectj\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7528AspectJ\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\" \/>\n<meta property=\"og:description\" content=\"\u7531\u4e8eSpring2\u7684AOP\u90e8\u5206\u4f5c\u4e86\u6bd4\u8f83\u5927\u7684\u8c03\u6574\uff0c\u5f88\u591a\u5730\u65b9\u7684\u4f7f\u7528\u5f15\u5165\u4e86AspectJ\u4e2d\u7684\u5185\u5bb9\uff0c\u4e3a\u4e86\u5b8c\u6210\u300a\u6df1\u5165Sp [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/\u7528aspectj\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f\/\" \/>\n<meta property=\"og:site_name\" content=\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-21T22:00:13+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"260\" \/>\n\t<meta property=\"og:image:height\" content=\"180\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin@wunen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin@wunen\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/\"},\"author\":{\"name\":\"admin@wunen\",\"@id\":\"http:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8\"},\"headline\":\"\u7528AspectJ\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f\",\"datePublished\":\"2025-04-21T22:00:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/\"},\"wordCount\":403,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/www.wunen.com\/#organization\"},\"image\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"articleSection\":[\"\u5bf9\u6218\u683c\u6597\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/\",\"url\":\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/\",\"name\":\"\u7528AspectJ\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"isPartOf\":{\"@id\":\"http:\/\/www.wunen.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"datePublished\":\"2025-04-21T22:00:13+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#primaryimage\",\"url\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"contentUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"width\":260,\"height\":180},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/www.wunen.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7528AspectJ\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.wunen.com\/#website\",\"url\":\"http:\/\/www.wunen.com\/\",\"name\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"description\":\"\u8f6f\u4ef6\u8d44\u8baf\u6765\u7269\u5ae9\",\"publisher\":{\"@id\":\"http:\/\/www.wunen.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.wunen.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/www.wunen.com\/#organization\",\"name\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"url\":\"http:\/\/www.wunen.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.wunen.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png\",\"contentUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png\",\"width\":1024,\"height\":1024,\"caption\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\"},\"image\":{\"@id\":\"http:\/\/www.wunen.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8\",\"name\":\"admin@wunen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.wunen.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g\",\"caption\":\"admin@wunen\"},\"sameAs\":[\"http:\/\/www.wunen.com\"],\"url\":\"http:\/\/www.wunen.com\/index.php\/author\/adminwunen\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u7528AspectJ\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/\u7528aspectj\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f\/","og_locale":"zh_CN","og_type":"article","og_title":"\u7528AspectJ\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","og_description":"\u7531\u4e8eSpring2\u7684AOP\u90e8\u5206\u4f5c\u4e86\u6bd4\u8f83\u5927\u7684\u8c03\u6574\uff0c\u5f88\u591a\u5730\u65b9\u7684\u4f7f\u7528\u5f15\u5165\u4e86AspectJ\u4e2d\u7684\u5185\u5bb9\uff0c\u4e3a\u4e86\u5b8c\u6210\u300a\u6df1\u5165Sp [&hellip;]","og_url":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/\u7528aspectj\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f\/","og_site_name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","article_published_time":"2025-04-21T22:00:13+00:00","og_image":[{"width":260,"height":180,"url":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","type":"image\/jpeg"}],"author":"admin@wunen","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin@wunen","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#article","isPartOf":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/"},"author":{"name":"admin@wunen","@id":"http:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8"},"headline":"\u7528AspectJ\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f","datePublished":"2025-04-21T22:00:13+00:00","mainEntityOfPage":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/"},"wordCount":403,"commentCount":0,"publisher":{"@id":"http:\/\/www.wunen.com\/#organization"},"image":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#primaryimage"},"thumbnailUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","articleSection":["\u5bf9\u6218\u683c\u6597"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/","url":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/","name":"\u7528AspectJ\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","isPartOf":{"@id":"http:\/\/www.wunen.com\/#website"},"primaryImageOfPage":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#primaryimage"},"image":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#primaryimage"},"thumbnailUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","datePublished":"2025-04-21T22:00:13+00:00","breadcrumb":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#primaryimage","url":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","contentUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","width":260,"height":180},{"@type":"BreadcrumbList","@id":"http:\/\/www.wunen.com\/index.php\/2025\/04\/22\/%e7%94%a8aspectj%e5%81%9a%e7%9a%84%e4%b8%80%e4%b8%aa%e5%9b%9e%e5%90%88%e6%a0%bc%e6%96%97%e5%b0%8f%e6%b8%b8%e6%88%8f\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/www.wunen.com\/"},{"@type":"ListItem","position":2,"name":"\u7528AspectJ\u505a\u7684\u4e00\u4e2a\u56de\u5408\u683c\u6597\u5c0f\u6e38\u620f"}]},{"@type":"WebSite","@id":"http:\/\/www.wunen.com\/#website","url":"http:\/\/www.wunen.com\/","name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","description":"\u8f6f\u4ef6\u8d44\u8baf\u6765\u7269\u5ae9","publisher":{"@id":"http:\/\/www.wunen.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.wunen.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Organization","@id":"http:\/\/www.wunen.com\/#organization","name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","url":"http:\/\/www.wunen.com\/","logo":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.wunen.com\/#\/schema\/logo\/image\/","url":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png","contentUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png","width":1024,"height":1024,"caption":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51"},"image":{"@id":"http:\/\/www.wunen.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"http:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8","name":"admin@wunen","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.wunen.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g","caption":"admin@wunen"},"sameAs":["http:\/\/www.wunen.com"],"url":"http:\/\/www.wunen.com\/index.php\/author\/adminwunen\/"}]}},"_links":{"self":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts\/1014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/comments?post=1014"}],"version-history":[{"count":0,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts\/1014\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/media\/215"}],"wp:attachment":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/media?parent=1014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/categories?post=1014"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/tags?post=1014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}