{"id":72106,"date":"2026-02-04T22:41:39","date_gmt":"2026-02-04T14:41:39","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/72106.html"},"modified":"2026-02-04T22:41:39","modified_gmt":"2026-02-04T14:41:39","slug":"spring-boot%e5%ae%9e%e6%88%98%ef%bc%9a%e7%94%a8aop%e8%87%aa%e5%ae%9a%e4%b9%89%e6%b3%a8%e8%a7%a3%e6%89%93%e9%80%a0%e9%9b%b6%e4%be%b5%e5%85%a5%e6%97%a5%e5%bf%97%e7%b3%bb%e7%bb%9f%ef%bc%88%e9%99%84","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/72106.html","title":{"rendered":"Spring Boot\u5b9e\u6218\uff1a\u7528AOP+\u81ea\u5b9a\u4e49\u6ce8\u89e3\u6253\u9020\u96f6\u4fb5\u5165\u65e5\u5fd7\u7cfb\u7edf\uff08\u9644\u751f\u4ea7\u907f\u5751\u6307\u5357\uff09"},"content":{"rendered":"<p>\u4f5c\u8005&#xff1a;\u4e0d\u60f3\u6253\u5de5\u7684\u7801\u519c \u539f\u521b\u58f0\u660e&#xff1a;\u672c\u6587\u57fa\u4e8e\u7b14\u8005\u5728\u91d1\u878d\u9879\u76ee\u4e2d\u7684\u771f\u5b9e\u5b9e\u8df5&#xff0c;\u6240\u6709\u4ee3\u7801\u7ecf\u751f\u4ea7\u73af\u5883\u9a8c\u8bc1&#xff0c;\u62d2\u7edd\u7eb8\u4e0a\u8c08\u5175<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u75db\u70b9\u76f4\u51fb&#xff1a;\u4f60\u662f\u5426\u4e5f\u8fd9\u6837\u5199\u65e5\u5fd7&#xff1f;<\/h3>\n<p>&#064;PostMapping(&#034;\/user&#034;)<br \/>\npublic Result createUser(&#064;RequestBody User user) {<br \/>\n    log.info(&#034;\u3010\u521b\u5efa\u7528\u6237\u3011\u53c2\u6570: {}&#034;, JSON.toJSONString(user)); \/\/ 1<br \/>\n    try {<br \/>\n        userService.save(user);<br \/>\n        log.info(&#034;\u3010\u521b\u5efa\u7528\u6237\u3011\u6210\u529f, \u7528\u6237ID: {}&#034;, user.getId()); \/\/ 2<br \/>\n        return Result.ok();<br \/>\n    } catch (Exception e) {<br \/>\n        log.error(&#034;\u3010\u521b\u5efa\u7528\u6237\u3011\u5931\u8d25, \u539f\u56e0: {}&#034;, e.getMessage(), e); \/\/ 3<br \/>\n        return Result.fail(&#034;\u64cd\u4f5c\u5931\u8d25&#034;);<br \/>\n    }<br \/>\n} <\/p>\n<p>\u7075\u9b42\u4e09\u95ee&#xff1a; \u274c \u4e1a\u52a1\u4ee3\u7801\u88ab\u65e5\u5fd7\u201c\u814c\u5165\u5473\u201d&#xff1f; \u274c \u4fee\u6539\u65e5\u5fd7\u683c\u5f0f\u8981\u6539\u4e0a\u767e\u4e2a\u65b9\u6cd5&#xff1f; \u274c \u654f\u611f\u5b57\u6bb5&#xff08;\u5bc6\u7801\/\u624b\u673a\u53f7&#xff09;\u88f8\u5954\u8bb0\u5f55&#xff1f;<\/p>\n<p>\u522b\u6025&#xff01;\u4eca\u5929\u624b\u628a\u624b\u5e26\u4f60\u7528\u00a0AOP&#043;\u81ea\u5b9a\u4e49\u6ce8\u89e3\u00a0\u7834\u5c40&#xff0c;\u4eb2\u6d4b\u5728\u65e5\u5747\u5343\u4e07\u7ea7\u8bf7\u6c42\u7cfb\u7edf\u4e2d\u7a33\u5b9a\u8fd0\u884c2\u5e74&#043;\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u6838\u5fc3\u8bbe\u8ba1\u601d\u8def&#xff08;\u62d2\u7edd\u7406\u8bba\u5806\u780c&#xff09;<\/h3>\n<p>\u8868\u683c<\/p>\n<table>\n<tr>\u65b9\u6848\u4f20\u7edf\u5199\u6cd5\u672c\u6587\u65b9\u6848<\/tr>\n<tbody>\n<tr>\n<td>\u4fb5\u5165\u6027<\/td>\n<td>\u6bcf\u4e2a\u65b9\u6cd5\u786c\u7f16\u7801<\/td>\n<td>\u4ec5\u9700&#064;OptLog(&#034;\u521b\u5efa\u7528\u6237&#034;)<\/td>\n<\/tr>\n<tr>\n<td>\u7ef4\u62a4\u6210\u672c<\/td>\n<td>\u6539\u4e00\u5904\u9700\u5168\u5c40\u641c<\/td>\n<td>\u6539\u5207\u9762\u7c7b\u4e00\u5904\u751f\u6548<\/td>\n<\/tr>\n<tr>\n<td>\u654f\u611f\u4fe1\u606f<\/td>\n<td>\u624b\u52a8\u8131\u654f\u6613\u9057\u6f0f<\/td>\n<td>\u5207\u9762\u7edf\u4e00\u62e6\u622a\u5904\u7406<\/td>\n<\/tr>\n<tr>\n<td>\u6027\u80fd\u5f71\u54cd<\/td>\n<td>\u540c\u6b65\u963b\u585e<\/td>\n<td>\u5f02\u6b65&#043;\u7ebf\u7a0b\u6c60\u4f18\u5316<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e3a\u4ec0\u4e48\u9009\u81ea\u5b9a\u4e49\u6ce8\u89e3\u800c\u975e\u76f4\u63a5\u5207Controller&#xff1f;<\/p>\n<p>\u7b14\u8005\u8e29\u5751\u5b9e\u5f55&#xff1a;\u66fe\u76f4\u63a5\u5207execution(* com.xxx.controller..*.*(..))&#xff0c;\u7ed3\u679cSwagger\u63a5\u53e3\u3001\u5065\u5eb7\u68c0\u67e5\u5168\u88ab\u8bb0\u5f55&#xff0c;\u65e5\u5fd7\u91cf\u66b4\u6da8300%&#xff01;\u7cbe\u51c6\u63a7\u5236\u624d\u662f\u751f\u4ea7\u73af\u5883\u738b\u9053\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001\u5b9e\u6218\u56db\u6b65\u8d70&#xff08;\u9644\u5173\u952e\u7ec6\u8282&#xff09;<\/h3>\n<h4>1\ufe0f\u20e3 \u5b9a\u4e49\u7075\u9b42\u6ce8\u89e3&#xff08;\u5e26\u64cd\u4f5c\u7c7b\u578b\u679a\u4e3e&#xff09;<\/h4>\n<p>&#064;Target(ElementType.METHOD)<br \/>\n&#064;Retention(RetentionPolicy.RUNTIME)<br \/>\n&#064;Documented<br \/>\npublic &#064;interface OptLog {<br \/>\n    String value() default &#034;&#034;; \/\/ \u64cd\u4f5c\u63cf\u8ff0<br \/>\n    OptType type() default OptType.OTHER; \/\/ \u64cd\u4f5c\u7c7b\u578b<\/p>\n<p>    enum OptType {<br \/>\n        QUERY(&#034;\u67e5\u8be2&#034;), SAVE(&#034;\u65b0\u589e&#034;), UPDATE(&#034;\u4fee\u6539&#034;), DELETE(&#034;\u5220\u9664&#034;), EXPORT(&#034;\u5bfc\u51fa&#034;), OTHER(&#034;\u5176\u4ed6&#034;);<br \/>\n        private final String desc;<br \/>\n        OptType(String desc) { this.desc &#061; desc; }<br \/>\n        public String getDesc() { return desc; }<br \/>\n    }<br \/>\n} <\/p>\n<p>\u2728\u00a0\u8bbe\u8ba1\u5de7\u601d&#xff1a;\u679a\u4e3e\u7c7b\u578b\u8ba9\u65e5\u5fd7\u53ef\u88abELK\u6309\u64cd\u4f5c\u7c7b\u578b\u805a\u5408\u5206\u6790&#xff0c;\u8fd0\u7ef4\u6392\u67e5\u6548\u7387\u63d0\u534750%<\/p>\n<h4>2\ufe0f\u20e3 \u7f16\u5199\u5207\u9762\u6838\u5fc3&#xff08;\u91cd\u70b9\u5904\u7406\u5f02\u5e38\u4e0e\u8017\u65f6&#xff09;<\/h4>\n<p>&#064;Aspect<br \/>\n&#064;Component<br \/>\n&#064;Slf4j<br \/>\npublic class LogAspect {<\/p>\n<p>    \/\/ \u5f02\u6b65\u7ebf\u7a0b\u6c60&#xff08;\u907f\u514d\u963b\u585e\u4e1a\u52a1&#xff09;<br \/>\n    private final ExecutorService logExecutor &#061; new ThreadPoolExecutor(<br \/>\n        2, 4, 60L, TimeUnit.SECONDS,<br \/>\n        new LinkedBlockingQueue&lt;&gt;(1000),<br \/>\n        r -&gt; new Thread(r, &#034;async-log-thread&#034;),<br \/>\n        new ThreadPoolExecutor.CallerRunsPolicy()<br \/>\n    );<\/p>\n<p>    &#064;Around(&#034;&#064;annotation(optLog)&#034;)<br \/>\n    public Object around(ProceedingJoinPoint pjp, OptLog optLog) throws Throwable {<br \/>\n        long start &#061; System.currentTimeMillis();<br \/>\n        String methodName &#061; pjp.getSignature().toShortString();<br \/>\n        Object result &#061; null;<br \/>\n        Exception exception &#061; null;<\/p>\n<p>        try {<br \/>\n            result &#061; pjp.proceed(); \/\/ \u6267\u884c\u76ee\u6807\u65b9\u6cd5<br \/>\n            return result;<br \/>\n        } catch (Exception e) {<br \/>\n            exception &#061; e;<br \/>\n            throw e; \/\/ \u4fdd\u8bc1\u5f02\u5e38\u6b63\u5e38\u629b\u51fa<br \/>\n        } finally {<br \/>\n            \/\/ \u5f02\u6b65\u8bb0\u5f55\u65e5\u5fd7&#xff08;\u5173\u952e&#xff01;&#xff09;<br \/>\n            logExecutor.execute(() -&gt; buildAndSaveLog(pjp, optLog, result, exception,<br \/>\n                System.currentTimeMillis() &#8211; start, methodName));<br \/>\n        }<br \/>\n    }<\/p>\n<p>    private void buildAndSaveLog(&#8230;) {<br \/>\n        \/\/ 1. \u53c2\u6570\u8131\u654f&#xff08;\u91cd\u70b9&#xff01;&#xff09;<br \/>\n        String argsStr &#061; JSON.toJSONString(pjp.getArgs(),<br \/>\n            SerializerFeature.WriteMapNullValue,<br \/>\n            \/\/ \u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668&#xff1a;\u5bc6\u7801\/\u624b\u673a\u53f7\u8131\u654f<br \/>\n            (o, fieldName, fieldType, features) -&gt; {<br \/>\n                if (&#034;password&#034;.equals(fieldName) || &#034;phone&#034;.equals(fieldName)) {<br \/>\n                    return &#034;******&#034;;<br \/>\n                }<br \/>\n                return SerializerFeature.EMPTY;<br \/>\n            });<\/p>\n<p>        \/\/ 2. \u6784\u5efa\u65e5\u5fd7\u5bf9\u8c61&#xff08;\u542b\u64cd\u4f5c\u4eba\u3001IP\u3001\u8017\u65f6\u7b49&#xff09;<br \/>\n        SysLog log &#061; SysLog.builder()<br \/>\n            .optModule(getModuleName(pjp)) \/\/ \u4ece\u5305\u8def\u5f84\u63d0\u53d6\u6a21\u5757\u540d<br \/>\n            .optType(optLog.type().getDesc())<br \/>\n            .optDesc(optLog.value())<br \/>\n            .requestParam(argsStr)<br \/>\n            .responseResult(exception &#061;&#061; null ? JSON.toJSONString(result) : &#034;\u5f02\u5e38:&#034; &#043; exception.getMessage())<br \/>\n            .costTime(costTime)<br \/>\n            .createTime(LocalDateTime.now())<br \/>\n            .build();<\/p>\n<p>        \/\/ 3. \u6301\u4e45\u5316&#xff08;\u6839\u636e\u73af\u5883\u9009\u62e9&#xff1a;\u5f00\u53d1\u63a7\u5236\u53f0\/\u751f\u4ea7\u5b58DB&#xff09;<br \/>\n        if (env.equals(&#034;prod&#034;)) {<br \/>\n            sysLogService.saveAsync(log); \/\/ \u5f02\u6b65\u5b58\u5e93<br \/>\n        } else {<br \/>\n            log.info(&#034;\u3010\u64cd\u4f5c\u65e5\u5fd7\u3011{}&#034;, JSON.toJSONString(log));<br \/>\n        }<br \/>\n    }<br \/>\n} <\/p>\n<h4>3\ufe0f\u20e3 \u4e1a\u52a1\u4ee3\u7801\u6e05\u723d\u793a\u4f8b<\/h4>\n<p>&#064;OptLog(value &#061; &#034;\u91cd\u7f6e\u7528\u6237\u5bc6\u7801&#034;, type &#061; OptLog.OptType.UPDATE)<br \/>\n&#064;PostMapping(&#034;\/resetPwd&#034;)<br \/>\npublic Result resetPassword(&#064;Valid &#064;RequestBody ResetPwdDTO dto) {<br \/>\n    \/\/ \u4e1a\u52a1\u903b\u8f91\u5e72\u51c0\u5f97\u50cf\u521a\u6d17\u8fc7\u7684\u4ee3\u7801<br \/>\n    userService.resetPassword(dto.getUserId(), dto.getNewPassword());<br \/>\n    return Result.ok(&#034;\u5bc6\u7801\u91cd\u7f6e\u6210\u529f&#034;);<br \/>\n}<br \/>\n\/\/ \u63a7\u5236\u53f0\u8f93\u51fa&#xff1a;\u3010\u64cd\u4f5c\u65e5\u5fd7\u3011{&#034;optModule&#034;:&#034;\u7528\u6237\u7ba1\u7406&#034;,&#034;optType&#034;:&#034;\u4fee\u6539&#034;,&#034;optDesc&#034;:&#034;\u91cd\u7f6e\u7528\u6237\u5bc6\u7801&#034;,&#8230;,&#034;requestParam&#034;:&#034;{\\\\&#034;userId\\\\&#034;:1001,\\\\&#034;newPassword\\\\&#034;:\\\\&#034;******\\\\&#034;}&#034;} <\/p>\n<h4>4\ufe0f\u20e3 \u751f\u4ea7\u73af\u5883\u52a0\u56fa&#xff08;\u8840\u6cea\u7ecf\u9a8c&#xff09;<\/h4>\n<ul>\n<li>\u9632\u65e5\u5fd7\u98ce\u66b4&#xff1a;\u5728\u5207\u9762\u5f00\u5934\u52a0if (log.isInfoEnabled())\u5224\u65ad<\/li>\n<li>\u5927\u5bf9\u8c61\u5904\u7406&#xff1a;\u5bf9MultipartFile\u7b49\u53c2\u6570\u8df3\u8fc7\u5e8f\u5217\u5316<\/li>\n<li>\u7ebf\u7a0b\u5b89\u5168&#xff1a;ThreadLocal\u5b58\u50a8\u64cd\u4f5c\u4eba\u4fe1\u606f&#xff08;\u914d\u5408\u62e6\u622a\u5668&#xff09;<\/li>\n<li>\u76d1\u63a7\u544a\u8b66&#xff1a;\u65e5\u5fd7\u5f02\u5e38\u65f6\u63a8\u9001\u4f01\u4e1a\u5fae\u4fe1&#xff08;\u793a\u4f8b\u4ee3\u7801\u7565&#xff0c;\u53ef\u79c1\u4fe1\u7d22\u53d6&#xff09;<\/li>\n<\/ul>\n<hr \/>\n<h3>\u56db\u3001\u6548\u679c\u5bf9\u6bd4 &amp; \u4ef7\u503c\u5347\u534e<\/h3>\n<p>\u8868\u683c<\/p>\n<table>\n<tr>\u7ef4\u5ea6\u6539\u9020\u524d\u6539\u9020\u540e<\/tr>\n<tbody>\n<tr>\n<td>\u5355\u63a5\u53e3\u4ee3\u7801\u91cf<\/td>\n<td>15&#043;\u884c\u65e5\u5fd7<\/td>\n<td>0\u884c\u4fb5\u5165<\/td>\n<\/tr>\n<tr>\n<td>\u65b0\u589e\u65e5\u5fd7\u9700\u6c42<\/td>\n<td>\u5168\u5c40\u641c\u7d22\u4fee\u6539<\/td>\n<td>\u4ec5\u8c03\u6574\u5207\u9762<\/td>\n<\/tr>\n<tr>\n<td>\u654f\u611f\u4fe1\u606f\u98ce\u9669<\/td>\n<td>\u9ad8&#xff08;\u4f9d\u8d56\u4eba\u5de5&#xff09;<\/td>\n<td>\u4f4e&#xff08;\u7edf\u4e00\u62e6\u622a&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u6392\u67e5\u6548\u7387<\/td>\n<td>\u7ffb\u627e\u4e1a\u52a1\u65e5\u5fd7<\/td>\n<td>\u6309\u64cd\u4f5c\u7c7b\u578b\u7cbe\u51c6\u7b5b\u9009<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0d\u6b62\u4e8e\u65e5\u5fd7&#xff1a;\u6b64\u6a21\u5f0f\u53ef\u590d\u7528\u4e8e \u2705 \u63a5\u53e3\u8017\u65f6\u76d1\u63a7&#xff08;\u5bf9\u63a5Prometheus&#xff09; \u2705 \u64cd\u4f5c\u5ba1\u8ba1\u7559\u75d5&#xff08;\u6ee1\u8db3\u7b49\u4fdd\u8981\u6c42&#xff09; \u2705 \u7070\u5ea6\u53d1\u5e03\u6d41\u91cf\u6807\u8bb0<\/p>\n<hr \/>\n<h3>\u4e94\u3001\u5199\u5728\u6700\u540e<\/h3>\n<p>\u6280\u672f\u6ca1\u6709\u94f6\u5f39&#xff0c;\u4f46\u89e3\u8026\u601d\u7ef4\u662f\u6c38\u6052\u7684\u5229\u5668\u3002AOP\u4e0d\u662f\u70ab\u6280&#xff0c;\u800c\u662f\u8ba9\u4ee3\u7801\u56de\u5f52\u4e1a\u52a1\u672c\u8d28\u7684\u5de5\u7a0b\u5b9e\u8df5\u3002\u7b14\u8005\u5728\u91cd\u6784\u67d0\u94f6\u884c\u6838\u5fc3\u7cfb\u7edf\u65f6&#xff0c;\u4ec5\u75283\u5929\u5c06200&#043;\u63a5\u53e3\u65e5\u5fd7\u7edf\u4e00\u6cbb\u7406&#xff0c;\u540e\u7eed\u8fd0\u7ef4\u53cd\u9988\u201c\u67e5\u95ee\u9898\u50cf\u5f00\u4e86\u5929\u773c\u201d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005&#xff1a;\u4e0d\u60f3\u6253\u5de5\u7684\u7801\u519c \u539f\u521b\u58f0\u660e&#xff1a;\u672c\u6587\u57fa\u4e8e\u7b14\u8005\u5728\u91d1\u878d\u9879\u76ee\u4e2d\u7684\u771f\u5b9e\u5b9e\u8df5&#xff0c;\u6240\u6709\u4ee3\u7801\u7ecf\u751f\u4ea7\u73af\u5883\u9a8c\u8bc1&#xff0c;\u62d2\u7edd\u7eb8\u4e0a\u8c08\u5175 \u4e00\u3001\u75db\u70b9\u76f4\u51fb&#xff1a;\u4f60\u662f\u5426\u4e5f\u8fd9\u6837\u5199\u65e5\u5fd7&#xff1f;<br \/>\nPostMapping(\\&#8221;\/user\\&#8221;)<br \/>\npublic Result createUser(RequestBody User user) {log.info(\\&#8221;\u3010\u521b\u5efa\u7528\u6237\u3011\u53c2\u6570: {}\\&#8221;, JSON.toJSONString(user)); \/\/ 1t<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,81,98],"topic":[],"class_list":["post-72106","post","type-post","status-publish","format-standard","hentry","category-server","tag-java","tag-python","tag-spring-boot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring Boot\u5b9e\u6218\uff1a\u7528AOP+\u81ea\u5b9a\u4e49\u6ce8\u89e3\u6253\u9020\u96f6\u4fb5\u5165\u65e5\u5fd7\u7cfb\u7edf\uff08\u9644\u751f\u4ea7\u907f\u5751\u6307\u5357\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/72106.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Boot\u5b9e\u6218\uff1a\u7528AOP+\u81ea\u5b9a\u4e49\u6ce8\u89e3\u6253\u9020\u96f6\u4fb5\u5165\u65e5\u5fd7\u7cfb\u7edf\uff08\u9644\u751f\u4ea7\u907f\u5751\u6307\u5357\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4f5c\u8005&#xff1a;\u4e0d\u60f3\u6253\u5de5\u7684\u7801\u519c \u539f\u521b\u58f0\u660e&#xff1a;\u672c\u6587\u57fa\u4e8e\u7b14\u8005\u5728\u91d1\u878d\u9879\u76ee\u4e2d\u7684\u771f\u5b9e\u5b9e\u8df5&#xff0c;\u6240\u6709\u4ee3\u7801\u7ecf\u751f\u4ea7\u73af\u5883\u9a8c\u8bc1&#xff0c;\u62d2\u7edd\u7eb8\u4e0a\u8c08\u5175 \u4e00\u3001\u75db\u70b9\u76f4\u51fb&#xff1a;\u4f60\u662f\u5426\u4e5f\u8fd9\u6837\u5199\u65e5\u5fd7&#xff1f; PostMapping(&quot;\/user&quot;) public Result createUser(RequestBody User user) {log.info(&quot;\u3010\u521b\u5efa\u7528\u6237\u3011\u53c2\u6570: {}&quot;, JSON.toJSONString(user)); \/\/ 1t\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/72106.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-04T14:41:39+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\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\" \/>\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\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72106.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/72106.html\",\"name\":\"Spring Boot\u5b9e\u6218\uff1a\u7528AOP+\u81ea\u5b9a\u4e49\u6ce8\u89e3\u6253\u9020\u96f6\u4fb5\u5165\u65e5\u5fd7\u7cfb\u7edf\uff08\u9644\u751f\u4ea7\u907f\u5751\u6307\u5357\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-04T14:41:39+00:00\",\"dateModified\":\"2026-02-04T14:41:39+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/72106.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/72106.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72106.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spring Boot\u5b9e\u6218\uff1a\u7528AOP+\u81ea\u5b9a\u4e49\u6ce8\u89e3\u6253\u9020\u96f6\u4fb5\u5165\u65e5\u5fd7\u7cfb\u7edf\uff08\u9644\u751f\u4ea7\u907f\u5751\u6307\u5357\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Boot\u5b9e\u6218\uff1a\u7528AOP+\u81ea\u5b9a\u4e49\u6ce8\u89e3\u6253\u9020\u96f6\u4fb5\u5165\u65e5\u5fd7\u7cfb\u7edf\uff08\u9644\u751f\u4ea7\u907f\u5751\u6307\u5357\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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":"https:\/\/www.wsisp.com\/helps\/72106.html","og_locale":"zh_CN","og_type":"article","og_title":"Spring Boot\u5b9e\u6218\uff1a\u7528AOP+\u81ea\u5b9a\u4e49\u6ce8\u89e3\u6253\u9020\u96f6\u4fb5\u5165\u65e5\u5fd7\u7cfb\u7edf\uff08\u9644\u751f\u4ea7\u907f\u5751\u6307\u5357\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4f5c\u8005&#xff1a;\u4e0d\u60f3\u6253\u5de5\u7684\u7801\u519c \u539f\u521b\u58f0\u660e&#xff1a;\u672c\u6587\u57fa\u4e8e\u7b14\u8005\u5728\u91d1\u878d\u9879\u76ee\u4e2d\u7684\u771f\u5b9e\u5b9e\u8df5&#xff0c;\u6240\u6709\u4ee3\u7801\u7ecf\u751f\u4ea7\u73af\u5883\u9a8c\u8bc1&#xff0c;\u62d2\u7edd\u7eb8\u4e0a\u8c08\u5175 \u4e00\u3001\u75db\u70b9\u76f4\u51fb&#xff1a;\u4f60\u662f\u5426\u4e5f\u8fd9\u6837\u5199\u65e5\u5fd7&#xff1f; PostMapping(\"\/user\") public Result createUser(RequestBody User user) {log.info(\"\u3010\u521b\u5efa\u7528\u6237\u3011\u53c2\u6570: {}\", JSON.toJSONString(user)); \/\/ 1t","og_url":"https:\/\/www.wsisp.com\/helps\/72106.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-04T14:41:39+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/72106.html","url":"https:\/\/www.wsisp.com\/helps\/72106.html","name":"Spring Boot\u5b9e\u6218\uff1a\u7528AOP+\u81ea\u5b9a\u4e49\u6ce8\u89e3\u6253\u9020\u96f6\u4fb5\u5165\u65e5\u5fd7\u7cfb\u7edf\uff08\u9644\u751f\u4ea7\u907f\u5751\u6307\u5357\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-04T14:41:39+00:00","dateModified":"2026-02-04T14:41:39+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/72106.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/72106.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/72106.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Spring Boot\u5b9e\u6218\uff1a\u7528AOP+\u81ea\u5b9a\u4e49\u6ce8\u89e3\u6253\u9020\u96f6\u4fb5\u5165\u65e5\u5fd7\u7cfb\u7edf\uff08\u9644\u751f\u4ea7\u907f\u5751\u6307\u5357\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=72106"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72106\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=72106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=72106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=72106"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=72106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}