{"id":350900,"date":"2023-07-28T09:02:10","date_gmt":"2023-07-28T09:02:10","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=350900"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=350900","title":{"rendered":"<span>\u041c\u0430\u0433\u0438\u044f Spring Framework \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>DISCLAIMER<\/h4>\n<blockquote>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u044b \u0432 \u0443\u0433\u043e\u0434\u0443 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u0434\u0435\u0438, \u0441\u0430\u043c\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u0434\u0435\u0438 \u043d\u0435 \u0441\u0442\u0440\u0430\u0434\u0430\u0435\u0442. \u0411\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u0432 <a href=\"https:\/\/github.com\/neshkeev\/spring-proxy-demo\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439<\/a>.<\/p>\n<\/blockquote>\n<h2>TLDR<\/h2>\n<p>\u041f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043e\u0439 &#171;\u043c\u0430\u0433\u0438\u0438&#187; Spring Framework. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 <code>@JmxExporter<\/code> \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0439 Spring Bean \u0432 JMX MBean. <\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/ad\/ce\/ik\/adceikkdmp319mk8mw3j5o5jank.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/ad\/ce\/ik\/adceikkdmp319mk8mw3j5o5jank.jpeg\" data-blurred=\"true\"\/><\/figure>\n<h2>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h2>\n<p>Spring Framework \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0444\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0435, \u0430 \u0432\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u043b\u0430\u043c\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u0422\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u0435\u0448\u0430\u0435\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@RestController<\/code> \u043d\u0430 \u0431\u0438\u043d, \u0438 \u0431\u0438\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c REST \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0435\u0442 Servlet Context, \u043d\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0438\u043b\u0438 \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440: \u0432\u0441\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0431\u0438\u043d\u043e\u0432. \u0417\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f Spring AOP &#8212; \u0430\u0441\u043f\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>Spring AOP \u0443\u0434\u043e\u0431\u0435\u043d, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434, \u043f\u043e\u0441\u043b\u0435 \u0438\u043b\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0431\u0438\u043d\u0430. \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c\u0438 &#8212; \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Spring AOP: \u043d\u0430\u0447\u0430\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 \u0438 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<p>Spring AOP \u0431\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u043c Spring \u0431\u0438\u043d\u0430\u043c, \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@Aspect<\/code>, \u043d\u043e \u043a\u0430\u043a \u043f\u043e\u0442\u043e\u043c \u044d\u0442\u043e\u0442 \u0431\u0438\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u0442\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f? \u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0431\u0438\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>BeanPostProcessor<\/code>.<\/p>\n<h2>\u041f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b<\/h2>\n<h3>\u041d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u041f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434. \u041f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435: \u043f\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0411\u0430\u0440\u0431\u0430\u0440\u044b \u041b\u0438\u0441\u043a\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044f \u0438\u043b\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437\u043c\u0435\u043d\u044f\u044f \u043b\u043e\u0433\u0438\u043a\u0443.<\/p>\n<h3>Proxy \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 JDK<\/h3>\n<p>\u0414\u0440\u0443\u0433\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441 <code>java.lang.reflect.Proxy<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 Java 1.3. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>Proxy<\/code> \u043c\u043e\u0436\u043d\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0422\u0430\u043a, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430: \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043a\u0441\u0438-\u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ul>\n<li>\n<p>\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0442.\u043a. <code>java.lang.reflect.Proxy<\/code> \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u0438\u043b\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>java.lang.reflect.InvocationHandler<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <code>java.lang.reflect.InvocationHandler#invoke<\/code> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 &#171;Hello, World!&#187;<\/h4>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 <code>\"Hello, World!\"<\/code>. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u0441\u0442\u0440\u043e\u043a\u0438 \u0432 java \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <code>java.lang.String<\/code>, \u0447\u0442\u043e \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f <code>Proxy<\/code>, \u0442.\u043a. \u043d\u0443\u0436\u0435\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u043a\u0441\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>java.lang.CharSequence<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438 \u043f\u0435\u0447\u0430\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0435\u044f\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>toString<\/code>, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c;<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0437\u043e\u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0435 <code>\"Hello, World!\"<\/code>.<\/p>\n<\/li>\n<\/ul>\n<ol>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>java.lang.reflect.InvocationHandler<\/code>:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public class HelloWorldInvocationHandler implements InvocationHandler {     public static final String HELLO_WORLD_MESSAGE = \"Hello, World!\";      @Override     public Object invoke(Object proxy, Method method, Object[] args) throws Exception {         if (\"toString\".equals(method.getName())) {             return HELLO_WORLD_MESSAGE;         }         return method.invoke(HELLO_WORLD_MESSAGE, args);     }  } <\/code><\/pre>\n<p>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>invoke<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0442\u0440\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: <\/p>\n<ul>\n<li>\n<p>\u0441\u0430\u043c \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0437\u0432\u0430\u043d \u043c\u0435\u0442\u043e\u0434. \u041c\u0435\u0442\u043e\u0434\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0442\u0430\u043a \u0438 \u043c\u0435\u0442\u043e\u0434\u044b <code>java.lang.Object<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u044a\u0435\u043a\u0442 <code>java.lang.reflect.Method<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0432 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>invoke<\/code> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0437\u043e\u0432\u044b \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Java Reflection API.<\/p>\n<\/li>\n<\/ul>\n<ol start=\"2\">\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public CharSequence helloWorldProxy() {     return (CharSequence) Proxy.newProxyInstance(         HelloWorldInvocationHandler.class.getClassLoader(),         new Class[]{CharSequence.class},         new HelloWorldInvocationHandler()); } <\/code><\/pre>\n<p>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 proxy \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>Proxy#newProxyInstance<\/code>, \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f: <\/p>\n<ul>\n<li>\n<p>\u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0432 \u043c\u0435\u0442\u043e\u0434 <code>invoke<\/code> \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u044b \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>Proxy#newProxyInstance<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0438\u043f\u0430 <code>java.lang.Object<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u044f\u0432\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0442\u0438\u043f \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 &#171;\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0430\u0440\u043e\u043b\u0435\u0439&#187;<\/h4>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>PasswordGenerator<\/code> \u0441 \u043e\u0434\u043d\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c <code>getPassword<\/code>:<\/p>\n<ol>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public interface PasswordGenerator {     String getPassword(); } <\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>java.lang.reflect.InvocationHandler<\/code> \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public class PasswordGeneratorInvocationHandler implements InvocationHandler {     private final String password;      public PasswordGeneratorInvocationHandler(int size) {         this.password = generatePassword(size);     }      @Override     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {         if (\"getPassword\".equals(method.getName())) return password;          return method.invoke(password, args);     }      private static String generatePassword(int size) {         \/\/ \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u043f\u0443\u0449\u0435\u043d\u0430     }  } <\/code><\/pre>\n<p>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p><code>PasswordGeneratorInvocationHandler<\/code> \u043c\u043e\u0436\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0430\u0440\u043e\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>PasswordGeneratorInvocationHandler<\/code> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>generatePassword<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>generatePassword<\/code> \u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u0432 \u0446\u0435\u043b\u044f\u0445 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u043c\u0435\u0441\u0442\u0430, \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/neshkeev\/spring-proxy-demo\/blob\/master\/src\/main\/java\/com\/github\/neshkeev\/spring\/proxy\/simple\/PasswordGeneratorInvocationHandler.java#L25\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>;<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>PasswordGeneratorInvocationHandler#invoke<\/code> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043a\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0431\u044b\u043b \u0432\u044b\u0437\u0432\u0430\u043d: <\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0431\u044b\u043b \u0432\u044b\u0437\u0432\u0430\u043d \u043c\u0435\u0442\u043e\u0434 <code>getPassword<\/code>, \u0442\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0438\u0437 \u043f\u043e\u043b\u044f <code>password<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 <code>password<\/code>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>getPassword<\/code>, \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u043d\u0430 \u0431\u0430\u0437\u0435 <code>PasswordGeneratorInvocationHandler<\/code>, \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<ol start=\"3\">\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public PasswordGenerator passwordGenerator() {     return (PasswordGenerator) Proxy.newProxyInstance(         PasswordGeneratorInvocationHandler.class.getClassLoader(),         new Class[]{PasswordGenerator.class},         new PasswordGeneratorInvocationHandler(32)); } <\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u0434\u0430\u043d\u0438\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u0440\u0430\u043d\u0435\u0435, \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 <code>PasswordGenerator<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0431\u044b\u043b \u0432\u044b\u0437\u0432\u0430\u043d <code>generatePassword<\/code>. \u0412 \u0446\u0435\u043b\u044f\u0445 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u041a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c <code>PasswordGeneratorInvocationHandler<\/code>, \u0447\u0442\u043e\u0431\u044b \u043c\u0435\u0442\u043e\u0434 <code>getPassword<\/code> \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0430 \u043f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u043e\u043a\u0441\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <code>IllegalStateException(\"Password has already been shown\")<\/code>?<\/p>\n<\/div>\n<\/details>\n<h4>\u041f\u0440\u043e\u043a\u0441\u0438 \u043a\u0430\u043a \u043e\u0431\u0451\u0440\u0442\u043a\u0430<\/h4>\n<p>\u041f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043e\u0431\u0451\u0440\u0442\u043a\u0430\u043c\u0438 \u043d\u0430\u0434 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438. \u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0432 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430:<\/p>\n<ul>\n<li>\n<p>\u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u0430, \u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u0433\u043e\u0434\u0438\u0442\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f <code>final<\/code> \u043a\u043b\u0430\u0441\u0441\u043e\u0432);<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (\u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043c\u0435\u0442\u0440\u0438\u043a\u0438), \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0430\u0441\u043f\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ul>\n<li>\n<p>\u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442,<\/p>\n<\/li>\n<li>\n<p>\u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>invoke<\/code> \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0433\u043e\u0442\u043e\u0432\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443,<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434 \u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0442\u043e\u0433\u0434\u0430:<\/p>\n<ol>\n<li>\n<p>\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>InvocationHandler<\/code> \u0434\u043b\u044f \u043e\u0431\u0435\u0440\u0442\u043a\u0438:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public class LoggerWrapperInvocationHandler&lt;T> implements InvocationHandler {     private final static Logger LOG = LoggerFactory.getLogger(LoggerWrapperInvocationHandler.class);      private final T delegate;      public LoggerWrapperInvocationHandler(T delegate) {         this.delegate = delegate;     }      @Override     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {         LOG.info(\"Start executing {}\", method.getName());         final var start = LocalDateTime.now();         try {             return method.invoke(delegate, args);         }         finally {             final var end = LocalDateTime.now();             LOG.info(\"End executing {} which took {}ns\",                 method.getName(),                 Duration.between(start, end).toNanos());         }     } } <\/code><\/pre>\n<p>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043a\u043b\u0430\u0441\u0441 <code>LoggerWrapperInvocationHandler<\/code> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d \u0442\u0438\u043f\u043e\u043c \u043e\u0431\u0451\u0440\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430,<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>invoke<\/code> \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 <code>delegate<\/code>,<\/p>\n<\/li>\n<li>\n<p>\u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0444\u0430\u043a\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u0439\u043c\u0435\u0440,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u043c \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<\/li>\n<\/ul>\n<ol start=\"2\">\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public&lt;K, V> Map&lt;K, V> wrappedMap(Map&lt;K, V> map) {     \/\/noinspection unchecked     return (Map&lt;K, V>) Proxy.newProxyInstance(         LoggerWrapperInvocationHandler.class.getClassLoader(),         new Class[]{Map.class},         new LoggerWrapperInvocationHandler&lt;>(map)); <\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d \u043a\u043e\u0434\u0443 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432, \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>wrappedMap<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>map<\/code> \u0442\u0438\u043f\u0430 <code>Map&lt;K, V><\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>Map<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u044a\u0435\u043a\u0442 <code>map<\/code> \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <code>LoggerWrapperInvocationHandler<\/code>.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 Spring Framework<\/h2>\n<p>Spring \u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u0430\u043a \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 <code>@Repository<\/code>: \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432 \u0441\u0432\u043e\u0435\u043c \u043a\u043e\u0434\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 Spring \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u0438\u043f\u043e\u0432\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 <code>@Transactional<\/code>: \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@Transactional<\/code> \u043a \u0441\u0432\u043e\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c, \u0430 Spring \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0438\u0445, \u0433\u0434\u0435 \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 \u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 REST API \u0447\u0435\u0440\u0435\u0437 <code>@RestController<\/code>: \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@RestController<\/code> \u043a \u0441\u0432\u043e\u0435\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442, \u0430 Spring \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442 <code>ServletContext<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 Kafka \u0447\u0435\u0440\u0435\u0437 <code>@KafkaListener<\/code>, \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 <code>@Async<\/code>, \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e <code>@Scheduled<\/code> \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435 &#8212; \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/p>\n<blockquote>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 Spring \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <a href=\"https:\/\/github.com\/cglib\/cglib\" rel=\"noopener noreferrer nofollow\">CGlib<\/a> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u043a\u0430\u043a \u0432 <code>java.lang.reflect.Proxy<\/code>.<br \/> \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 cglib \u0438\u0437\u0431\u0430\u0432\u0438\u043b\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u043a Spring \u0431\u0438\u043d\u0430\u043c.<br \/> \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 cglib \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Proxy<\/code> \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438 JDK, \u0447\u0442\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0434\u0435\u044e.<\/p>\n<\/blockquote>\n<h3>\u0422\u043e\u0447\u043a\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f<\/h3>\n<p>\u041b\u044e\u0431\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c Spring \u0431\u0438\u043d\u043e\u043c, \u0435\u0441\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Spring \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0438\u043d\u0430 \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0436\u0438\u0437\u043d\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>Spring Framework \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u0435\u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u043e\u0434. \u041a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0431\u0438\u043d\u0430, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e\u0432\u0435\u0441\u0438\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p><code>@PostConstruct<\/code> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u0438\u043d \u0441\u043e\u0437\u0434\u0430\u043d;<\/p>\n<\/li>\n<li>\n<p><code>@PreDestroy<\/code> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0430 \u0431\u0438\u043d \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d.<\/p>\n<\/li>\n<\/ul>\n<h3>BeanPostProcessor<\/h3>\n<p>\u041f\u043e\u0434\u0445\u043e\u0434 \u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u0434\u0430 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432 \u0431\u0438\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f. \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043d\u0435 \u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u0434 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0431\u0438\u043d\u043e\u0432. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u0434\u0435\u043b\u043e \u0432\u0441\u0442\u0443\u043f\u0430\u0435\u0442 <code>org.springframework.beans.factory.config.BeanPostProcessor<\/code> &#8212; \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0411\u0438\u043d <code>BeanPostProcessor<\/code> \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0431\u044f \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 Spring \u0431\u0438\u043d\u044b \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u0434 \u0434\u043b\u044f \u043d\u0438\u0445. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u043d\u044b \u043f\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 <code>@RestConroller<\/code> \u0431\u0438\u043d\u044b \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u043b\u0435\u0442\u044b, \u0438\u043b\u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 <code>@KafkaListener<\/code> \u0431\u0438\u043d\u044b \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043a\u0430\u043a Kafka \u043a\u043e\u043d\u0441\u044c\u044e\u043c\u0435\u0440\u044b. \u041e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0442\u0438\u043f\u0430 <code>BeanPostProcessor<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043d\u043e\u0433\u043e, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0438 \u0432 \u044d\u0442\u043e\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f &#171;\u043c\u0430\u0433\u0438\u044f&#187; Spring Framework.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440<\/h3>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>BeanPostProcessor<\/code> \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e JMX MBean \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0438\u043d\u0430, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@JmxExporter<\/code>:<\/p>\n<pre><code class=\"java\">@Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface JmxExporter {     String name() default \"\"; } <\/code><\/pre>\n<h4>Java Management Extensions (JMX)<\/h4>\n<p>Java Management Extensions (JMX) &#8212; \u044d\u0442\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c java \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0422\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f JMX \u0432\u0432\u043e\u0434\u0438\u0442 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 MBean, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u0441\u0435 MBean \u0431\u0438\u043d\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0438\u0437\u0432\u043d\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043e\u0434\u0438\u043d \u0438\u0437 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 MBean \u0431\u0438\u043d\u043e\u0432.<\/p>\n<p>\u0421\u0430\u043c\u044b\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 MBean \u0431\u0438\u043d\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b (<code>int<\/code>, <code>boolean<\/code>, <code>char<\/code> \u0438 \u0442.\u0434.),<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0430\u0434 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u043c\u0438 (<code>Integer<\/code>, <code>Boolean<\/code>, <code>Character<\/code> \u0438 \u0442.\u0434.),<\/p>\n<\/li>\n<li>\n<p><code>java.lang.String<\/code><\/p>\n<\/li>\n<li>\n<p><code>byte[]<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u044d\u0442\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 <code>json<\/code> \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u044b\u0437\u043e\u0432\u0430 MBean \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 JMX \u043a\u043b\u0438\u0435\u043d\u0442 &#8212; \u044d\u0442\u043e jconsole, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0443 JDK.<\/p>\n<h4>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f MBean<\/h4>\n<p>\u041b\u044e\u0431\u043e\u0439 Spring \u0431\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@JmxExporter<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0435\u043c\u0443 <code>MBean<\/code>, \u0442.\u0435. \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0431\u0438\u043d\u043e\u0432, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c <code>BeanPostProcessor<\/code>:<\/p>\n<pre><code class=\"java\">public class JmxExporterPostProcessor implements BeanPostProcessor {      @Override     public Object postProcessAfterInitialization(@NonNull Object bean, @NonNull String beanName) throws BeansException {         registerMBean(bean, beanName);         return bean;     }      private void registerMBean(Object bean, String beanName) {         final Class&lt;?> aClass = bean.getClass();         final var annotation = aClass.getAnnotation(JmxExporter.class);         if (annotation == null) return;          try {             final var name = StringUtils.hasText(annotation.name())                     ? annotation.name()                     : beanName;              final var objectName = new ObjectName(aClass.getPackageName() + \":type=basic,name=\" + name);              final var platformMBeanServer = ManagementFactory.getPlatformMBeanServer();             final var proxy = getDynamicMBean(bean);             platformMBeanServer.registerMBean(proxy, objectName);         }         catch (Exception e) {             throw new RuntimeException(e);         }     }      private DynamicMBean getDynamicMBean(Object bean) {         \/\/ \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0438\u0436\u0435         return null;     } } <\/code><\/pre>\n<p>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043a\u0430\u0436\u0434\u044b\u0439 Spring \u0431\u0438\u043d \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u043f\u043e \u0432\u0441\u0435\u043c <code>BeanPostProcessor<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 \u043c\u0435\u0442\u043e\u0434 <code>postProcessAfterInitialization<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f <code>MBean<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u0431\u0438\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 <code>registerMBean<\/code> \u0438 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430;<\/p>\n<\/li>\n<li>\n<p>Spring \u0431\u0438\u043d\u044b \u0431\u0435\u0437 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@JmxExporter<\/code> \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0438\u043c\u044f \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@JmxExporter<\/code>, \u0442\u043e \u0438\u043c\u044f Spring \u0431\u0438\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>MBean<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>ManagementFactory#getPlatformMBeanServer<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>MBeanServer<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f singleton \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u044a\u0435\u043a\u0442 <code>MBean<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>javax.management.DynamicMBean<\/code> \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>getDynamicMBean<\/code>;<\/p>\n<\/li>\n<\/ul>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 MBean<\/h4>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 <code>MBean<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>DynamicMBean<\/code>, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>MBean<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>JmxExporterPostProcessor#getDynamicMBean<\/code>:<\/p>\n<pre><code class=\"java\">private DynamicMBean getDynamicMBean(Object bean) {     return (DynamicMBean) Proxy.newProxyInstance(             JmxExporterPostProcessor.class.getClassLoader(),             new Class[]{DynamicMBean.class},             new JmxWrapperInvocationHandler(bean)); } <\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <code>MBean<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432, \u043e\u0442\u043b\u0438\u0447\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e Spring \u0431\u0438\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <code>JmxWrapperInvocationHandler<\/code>, \u0433\u0434\u0435 \u0431\u0438\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0435.<\/p>\n<h4>InvocationHandler \u0434\u043b\u044f MBean \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/h4>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>InvocationHandler<\/code> \u0434\u043b\u044f <code>MBean<\/code> \u0431\u0438\u043d\u043e\u0432:<\/p>\n<pre><code class=\"java\">public class JmxWrapperInvocationHandler implements InvocationHandler {      private final Object bean;      public JmxWrapperInvocationHandler(Object bean) {         this.bean = bean;     }      @Override     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {         return switch (method.getName()) {             case \"getAttribute\", \"setAttribute\", \"getAttributes\", \"setAttributes\" -> null;             case \"getMBeanInfo\" ->                     new MBeanInfo(bean.getClass().getName(),                             bean.getClass().getName(),                             new MBeanAttributeInfo[0],                             new MBeanConstructorInfo[0],                             \/\/ \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b                             MBeanUtils.operations(bean.getClass()),                             new MBeanNotificationInfo[0]);             case \"invoke\" -> invokeProxy(args);             default -> throw new UnsupportedOperationException(method.getName());         };     }      private Object invokeProxy(Object[] args) throws Exception {         final var actionName = (String) args[0];         final var params = (Object[]) args[1];                  final Class&lt;?>[] paramTypes = Arrays.stream(params)                 .map(Object::getClass)                 .toArray(Class&lt;?>[]::new);                  final var declaredMethod = bean.getClass().getDeclaredMethod(actionName, paramTypes);         return declaredMethod.invoke(bean, params);     } } <\/code><\/pre>\n<p>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>InvocationHandler<\/code> \u0434\u043b\u044f <code>MBean<\/code> \u0431\u0438\u043d\u043e\u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0434\u043b\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0430\u0434 \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>javax.management.DynamicMBean<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0448\u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0438\u0437 \u043d\u0438\u0445 \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443: <\/p>\n<ul>\n<li>\n<p><code>getMBeanInfo<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <code>MBeanInfo<\/code> &#8212; \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 <code>MBean<\/code> \u0431\u0438\u043d\u0430, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 (\u043a\u0430\u0436\u0434\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e Spring \u0431\u0438\u043d\u0430);<\/p>\n<\/li>\n<li>\n<p><code>invoke<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>invokeProxy<\/code> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0438\u0441\u043a \u043c\u0435\u0442\u043e\u0434\u0430 Spring \u0431\u0438\u043d\u0430 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 Spring \u0431\u0438\u043d\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>JmxWrapperInvocationHandler<\/code> \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0430 \u0432 \u0443\u0433\u043e\u0434\u0443 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0441\u0442\u0438. \u041e\u043d\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 Spring \u0431\u0438\u043d \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b, \u0432 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u0442\u0438\u043f\u044b, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0442 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445, <code>String<\/code> \u0438 <code>byte[]<\/code>. \u0411\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u043d\u0443\u044e \u0434\u043b\u044f \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u0432\u0435\u0440\u0441\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u043b\u0438 \u0432 <a href=\"https:\/\/github.com\/neshkeev\/spring-proxy-demo\/blob\/master\/src\/main\/java\/com\/github\/neshkeev\/spring\/proxy\/jmx\/JmxWrapperInvocationHandler.java\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439<\/a>.<\/p>\n<h4>\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f JMX<\/h4>\n<p>\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 MBean \u0431\u0438\u043d\u043e\u0432 \u043f\u043e Spring \u0431\u0438\u043d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 REST \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430:<\/p>\n<pre><code class=\"java\">@JmxExporter @RestController public class CustomerController {     private final Map&lt;Integer, Customer> customers = new HashMap&lt;>();      @PostMapping(\"\/customers\")     public void add(@RequestBody Customer customer) {         customers.put(customer.id(), customer);     }      @GetMapping(\"\/customers\/{id}\")     public Customer get(@PathVariable(\"id\") int id) {         return customers.get(id);     }      @GetMapping(\"\/customers\")     public Collection&lt;Customer> list() {         return customers.values();     } } <\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u043e\u0432\u044b\u043c REST \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043b\u0438\u0448\u043d\u0438. \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043b\u0438\u0448\u044c, \u0447\u0442\u043e \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@RestController<\/code> \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <code>@JmxExporter<\/code>.<\/p>\n<p><code>Customer<\/code> &#8212; \u044d\u0442\u043e <code>record<\/code> \u0441 \u0442\u0440\u0435\u043c\u044f \u043f\u043e\u043b\u044f\u043c\u0438:<\/p>\n<pre><code class=\"java\">public record Customer(int id, String name, boolean active) { } <\/code><\/pre>\n<h4>\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b<\/h4>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0435\u043c\u0443 \u043f\u043e JMX \u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e <code>CustomerController<\/code> \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <code>MBean<\/code> \u0431\u0438\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0435 \u0442\u0440\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438: <code>add<\/code>, <code>get<\/code>, <code>list<\/code>.<\/p>\n<ol>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 curl, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 JMX:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\">curl http:\/\/localhost:8080\/customers \\     -X POST \\     -H \"Content-type: application\/json\" \\     -d '{\"id\":1,\"name\":\"Hello, World!\", \"active\": true}' <\/code><\/pre>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/x3\/gf\/mr\/x3gfmrh0p0bwovimu-lnu3rxpbu.png\" alt=\"JMX get operation\" data-src=\"https:\/\/habrastorage.org\/webt\/x3\/gf\/mr\/x3gfmrh0p0bwovimu-lnu3rxpbu.png\"\/><\/p>\n<div><figcaption>JMX get operation<\/figcaption><\/div>\n<\/figure>\n<ol start=\"2\">\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 JMX, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code>curl<\/code>: <\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/k5\/3w\/x4\/k53wx4uclnyvfkb6yp6kqeyii9u.png\" alt=\"JMX add operation\" data-src=\"https:\/\/habrastorage.org\/webt\/k5\/3w\/x4\/k53wx4uclnyvfkb6yp6kqeyii9u.png\"\/><\/p>\n<div><figcaption>JMX add operation<\/figcaption><\/div>\n<\/figure>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\">curl -s http:\/\/localhost:8080\/customers\/2 | json_pp {    \"active\" : true,    \"id\" : 2,    \"name\" : \"Jmx Client!\" } <\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\">curl -s http:\/\/localhost:8080\/customers | json_pp [    {       \"active\" : true,       \"id\" : 1,       \"name\" : \"Hello, World!\"    },    {       \"active\" : true,       \"id\" : 2,       \"name\" : \"Jmx Client!\"    } ] <\/code><\/pre>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/lz\/iw\/qj\/lziwqjdvha-yhwmp3vz6tdmcezq.png\" data-src=\"https:\/\/habrastorage.org\/webt\/lz\/iw\/qj\/lziwqjdvha-yhwmp3vz6tdmcezq.png\"\/><\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e, \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0440\u043e\u043a\u0441\u0438 <code>BeanPostProcessor<\/code> \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c &#171;\u043c\u0430\u0433\u0438\u044e&#187; Spring \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438. \u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/github.com\/neshkeev\/spring-proxy-demo\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439<\/a>, \u0433\u0434\u0435 \u0442\u0430\u043a \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0442\u0435\u0441\u0442\u044b \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 Gitpod, \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 (50 \u0447\u0430\u0441\u043e\u0432 \u0432 \u043c\u0435\u0441\u044f\u0446 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e).<\/p>\n<p><a href=\"https:\/\/gitpod.io\/#https:\/\/github.com\/neshkeev\/spring-proxy-demo\" rel=\"noopener noreferrer nofollow\"><img loading=\"lazy\" decoding=\"async\" inline=\"true\" class=\"image image-inline\" src=\"https:\/\/img.shields.io\/badge\/Open%20in%20Gitpod-908a85?logo=gitpod\" width=\"0\" height=\"0\"\/><\/a><\/p>\n<h2>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e<\/h2>\n<p>\u041a\u043e\u0434 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u044b\u043b \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d \u0432 \u0443\u0433\u043e\u0434\u0443 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u043a\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0435\u043c\u0435, \u0430 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u044c \u0435\u0433\u043e \u043e\u0434\u0438\u043d-\u0432-\u043e\u0434\u0438\u043d, \u0442\u043e \u043d\u0435 \u0432\u0441\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/neshkeev\/spring-proxy-demo\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439<\/a>. \u041d\u0438\u0436\u0435 \u0432 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u0430\u0445 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430 GitHub \u043f\u0440\u043e\u043f\u0430\u0434\u0435\u0442 \u0438\u043b\u0438 \u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d.<\/p>\n<details class=\"spoiler\">\n<summary>JmxExporterPostProcessor.java<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.context.annotation.Lazy; import org.springframework.lang.NonNull; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils;  import javax.management.DynamicMBean; import javax.management.ObjectName; import java.lang.management.ManagementFactory; import java.lang.reflect.Proxy;  @Component public class JmxExporterPostProcessor implements BeanPostProcessor {     private final MBeanInvocable mBeanInvocable;      @Lazy     public JmxExporterPostProcessor(MBeanInvocable mBeanInvocable) {         this.mBeanInvocable = mBeanInvocable;     }      @Override     public Object postProcessAfterInitialization(@NonNull Object bean, @NonNull String beanName) throws BeansException {         registerMBean(bean, beanName);         return bean;     }      private void registerMBean(Object bean, String beanName) {         final Class&lt;?> aClass = bean.getClass();         final var annotation = aClass.getAnnotation(JmxExporter.class);         if (annotation == null) return;          try {             final var name = StringUtils.hasText(annotation.name())                     ? annotation.name()                     : beanName;              final var objectName = new ObjectName(aClass.getPackageName() + \":type=basic,name=\" + name);              final var platformMBeanServer = ManagementFactory.getPlatformMBeanServer();             final var proxy = getDynamicMBean(bean);             platformMBeanServer.registerMBean(proxy, objectName);         }         catch (Exception e) {             throw new RuntimeException(e);         }     }      private DynamicMBean getDynamicMBean(Object bean) {         return (DynamicMBean) Proxy.newProxyInstance(                 JmxExporterPostProcessor.class.getClassLoader(),                 new Class[]{DynamicMBean.class},                 new JmxWrapperInvocationHandler(mBeanInvocable, bean));     } } <\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>JmxWrapperInvocationHandler.java<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import javax.management.MBeanAttributeInfo; import javax.management.MBeanConstructorInfo; import javax.management.MBeanInfo; import javax.management.MBeanNotificationInfo; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method;  public class JmxWrapperInvocationHandler implements InvocationHandler {      private final MBeanInvocable mBeanInvocable;      private final Object bean;      public JmxWrapperInvocationHandler(MBeanInvocable mBeanInvocable, Object bean) {         this.mBeanInvocable = mBeanInvocable;         this.bean = bean;     }      @Override     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {         return switch (method.getName()) {             case \"getAttribute\", \"setAttribute\", \"getAttributes\", \"setAttributes\" -> null;             case \"getMBeanInfo\" ->                     new MBeanInfo(bean.getClass().getName(),                             bean.getClass().getName(),                             new MBeanAttributeInfo[0],                             new MBeanConstructorInfo[0],                             MBeanUtils.operations(bean.getClass()),                             new MBeanNotificationInfo[0]);             case \"invoke\" -> invoke(args);             default -> throw new UnsupportedOperationException(method.getName());         };     }      private Object invoke(Object[] args) throws Exception {         final var actionName = (String) args[0];         final var params = (Object[]) args[1];          return mBeanInvocable.getResult(bean, actionName, params);     } } <\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>MBeanInvocable.java<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.stereotype.Service;  import java.lang.invoke.MethodType; import java.lang.reflect.Method; import java.util.*;  @Service public class MBeanInvocable {      private final ObjectMapper objectMapper;      public MBeanInvocable(ObjectMapper objectMapper) {         this.objectMapper = objectMapper;     }      public Object getResult(Object target, String methodName, Object[] params) throws ReflectiveOperationException, JsonProcessingException {         var invocable = prepareMethod(target, methodName, params);         var result = invocable.invoke(target);         return augmentResult(result);     }      private record PreparedInvocable(Method method, Object[] args) {         private Object invoke(Object target) throws ReflectiveOperationException {             return method.invoke(target, args);         }     }      private PreparedInvocable prepareMethod(Object target, String methodName, Object[] params) throws NoSuchMethodException, JsonProcessingException {         final var args = new Object[params.length];         final var candidates = getCandidateMethods(target, methodName);          for (Method candidate : candidates) {             if (candidate.getParameterCount() != params.length) continue;              int i = 0;             for (; i &lt; candidate.getParameterCount(); i++) {                 final Object jmxParam = params[i];                 final var methodParam = candidate.getParameters()[i];                  if (jmxParam != null) {                     args[i] = tryConvert(jmxParam, methodParam.getType());                     if (args[i] == null) break;                 }                 else {                     args[i] = null;                 }             }              if (i == candidate.getParameterCount()) {                 return new PreparedInvocable(candidate, args);             }         }         throw new NoSuchMethodException(\"No method matches the required signature\");     }      private Object tryConvert(Object jmxParam, Class&lt;?> paramType) throws JsonProcessingException {         final var primitiveJmxType = MethodType.methodType(jmxParam.getClass()).unwrap().returnType();          if (jmxParam.getClass() != paramType &amp;&amp; primitiveJmxType != paramType) {             if (!jmxParam.getClass().equals(String.class)) {                 return Optional.empty();             }              return objectMapper.readValue(jmxParam.toString(), paramType);         }         return jmxParam;     }      private List&lt;Method> getCandidateMethods(Object target, String actionName) throws NoSuchMethodException {         final var candidates = new ArrayList&lt;Method>();         for (Method method : target.getClass().getMethods()) {             if (method.getName().equals(actionName)) {                 candidates.add(method);             }         }          if (candidates.isEmpty()) {             throw new NoSuchMethodException(\"The \" + actionName + \" method doesn't exist in \" + target.getClass());         }         return candidates;     }      private Object augmentResult(final Object result) throws JsonProcessingException {         if (result == null) {             return null;         }          if (result.getClass().isPrimitive()) {             return result;         }          if (result.getClass().getPackageName().equals(\"java.lang\")) {             return result;         }          if (result instanceof Collection&lt;?>) {             return collectObjects(((Collection&lt;?>) result));         }          if (result instanceof Map&lt;?, ?>) {             return collectObjects(((Map&lt;?, ?>) result).entrySet());         }          return objectMapper.writeValueAsString(result);     }      private &lt;T> List&lt;String> collectObjects(Collection&lt;T> collection) throws JsonProcessingException {         var result = new ArrayList&lt;String>(collection.size());         for (T element : collection) {             result.add(objectMapper.writeValueAsString(element));         }         return result;     } } <\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>MBeanUtils.java<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\"> import javax.management.*; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Arrays;  public class MBeanUtils {      public static MBeanOperationInfo[] operations(final Class&lt;?> type) {         return Arrays.stream(type.getDeclaredMethods())                 .filter(m -> Modifier.isPublic(m.getModifiers()))                 .map(MBeanUtils::getmBeanOperationInfo)                 .toArray(MBeanOperationInfo[]::new);     }      private static MBeanOperationInfo getmBeanOperationInfo(final Method m) {         final var params = Arrays.stream(m.getParameters())                 .map(p -> new MBeanParameterInfo(p.getName(), getPrimitiveTypeOrString(p.getType()), p.getName()))                 .toArray(MBeanParameterInfo[]::new);          return new MBeanOperationInfo(m.getName(),                 m.getName(),                 params,                 getPrimitiveTypeOrString(m.getReturnType()),                 MBeanOperationInfo.UNKNOWN);     }      private static String getPrimitiveTypeOrString(final Class&lt;?> type) {         if (type.isPrimitive()) {             return type.getTypeName();         }          if (String.class.getPackage() == type.getPackage()) {             return type.getTypeName();         }          return String.class.getName();     } } <\/code><\/pre>\n<\/div>\n<\/details>\n<h2>\u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b<\/h2>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <code>org.slf4j.Logger<\/code> \u0432\u043e \u0432\u0441\u0435 \u043f\u043e\u043b\u044f Spring \u0431\u0438\u043d\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@WithLogger<\/code>.<\/p>\n<pre><code class=\"java\">@Service public class MyService {     @WithLogger     private org.slf4j.Logger logger;      void action() {         logger.info(\"Action!\");     } } <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/750894\/\"> https:\/\/habr.com\/ru\/articles\/750894\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>DISCLAIMER<\/h4>\n<blockquote>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u044b \u0432 \u0443\u0433\u043e\u0434\u0443 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u0434\u0435\u0438, \u0441\u0430\u043c\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u0434\u0435\u0438 \u043d\u0435 \u0441\u0442\u0440\u0430\u0434\u0430\u0435\u0442. \u0411\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u0432 <a href=\"https:\/\/github.com\/neshkeev\/spring-proxy-demo\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439<\/a>.<\/p>\n<\/blockquote>\n<h2>TLDR<\/h2>\n<p>\u041f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043e\u0439 &#171;\u043c\u0430\u0433\u0438\u0438&#187; Spring Framework. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 <code>@JmxExporter<\/code> \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0439 Spring Bean \u0432 JMX MBean. <\/p>\n<figure class=\"\"><\/figure>\n<h2>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h2>\n<p>Spring Framework \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0444\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0435, \u0430 \u0432\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u043b\u0430\u043c\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u0422\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u0435\u0448\u0430\u0435\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@RestController<\/code> \u043d\u0430 \u0431\u0438\u043d, \u0438 \u0431\u0438\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c REST \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0435\u0442 Servlet Context, \u043d\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0438\u043b\u0438 \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440: \u0432\u0441\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0431\u0438\u043d\u043e\u0432. \u0417\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f Spring AOP &#8212; \u0430\u0441\u043f\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>Spring AOP \u0443\u0434\u043e\u0431\u0435\u043d, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434, \u043f\u043e\u0441\u043b\u0435 \u0438\u043b\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0431\u0438\u043d\u0430. \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c\u0438 &#8212; \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Spring AOP: \u043d\u0430\u0447\u0430\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 \u0438 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<p>Spring AOP \u0431\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u043c Spring \u0431\u0438\u043d\u0430\u043c, \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@Aspect<\/code>, \u043d\u043e \u043a\u0430\u043a \u043f\u043e\u0442\u043e\u043c \u044d\u0442\u043e\u0442 \u0431\u0438\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u0442\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f? \u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0431\u0438\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>BeanPostProcessor<\/code>.<\/p>\n<h2>\u041f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b<\/h2>\n<h3>\u041d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u041f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434. \u041f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435: \u043f\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0411\u0430\u0440\u0431\u0430\u0440\u044b \u041b\u0438\u0441\u043a\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044f \u0438\u043b\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437\u043c\u0435\u043d\u044f\u044f \u043b\u043e\u0433\u0438\u043a\u0443.<\/p>\n<h3>Proxy \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 JDK<\/h3>\n<p>\u0414\u0440\u0443\u0433\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441 <code>java.lang.reflect.Proxy<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 Java 1.3. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>Proxy<\/code> \u043c\u043e\u0436\u043d\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0422\u0430\u043a, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430: \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043a\u0441\u0438-\u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ul>\n<li>\n<p>\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0442.\u043a. <code>java.lang.reflect.Proxy<\/code> \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u0438\u043b\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>java.lang.reflect.InvocationHandler<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <code>java.lang.reflect.InvocationHandler#invoke<\/code> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 &#171;Hello, World!&#187;<\/h4>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 <code>\"Hello, World!\"<\/code>. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u0441\u0442\u0440\u043e\u043a\u0438 \u0432 java \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <code>java.lang.String<\/code>, \u0447\u0442\u043e \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f <code>Proxy<\/code>, \u0442.\u043a. \u043d\u0443\u0436\u0435\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u043a\u0441\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>java.lang.CharSequence<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438 \u043f\u0435\u0447\u0430\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0435\u044f\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>toString<\/code>, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c;<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0437\u043e\u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0435 <code>\"Hello, World!\"<\/code>.<\/p>\n<\/li>\n<\/ul>\n<ol>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>java.lang.reflect.InvocationHandler<\/code>:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public class HelloWorldInvocationHandler implements InvocationHandler {     public static final String HELLO_WORLD_MESSAGE = \"Hello, World!\";      @Override     public Object invoke(Object proxy, Method method, Object[] args) throws Exception {         if (\"toString\".equals(method.getName())) {             return HELLO_WORLD_MESSAGE;         }         return method.invoke(HELLO_WORLD_MESSAGE, args);     }  } <\/code><\/pre>\n<p>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>invoke<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0442\u0440\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: <\/p>\n<ul>\n<li>\n<p>\u0441\u0430\u043c \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0437\u0432\u0430\u043d \u043c\u0435\u0442\u043e\u0434. \u041c\u0435\u0442\u043e\u0434\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0442\u0430\u043a \u0438 \u043c\u0435\u0442\u043e\u0434\u044b <code>java.lang.Object<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u044a\u0435\u043a\u0442 <code>java.lang.reflect.Method<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0432 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>invoke<\/code> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0437\u043e\u0432\u044b \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Java Reflection API.<\/p>\n<\/li>\n<\/ul>\n<ol start=\"2\">\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public CharSequence helloWorldProxy() {     return (CharSequence) Proxy.newProxyInstance(         HelloWorldInvocationHandler.class.getClassLoader(),         new Class[]{CharSequence.class},         new HelloWorldInvocationHandler()); } <\/code><\/pre>\n<p>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 proxy \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>Proxy#newProxyInstance<\/code>, \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f: <\/p>\n<ul>\n<li>\n<p>\u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0432 \u043c\u0435\u0442\u043e\u0434 <code>invoke<\/code> \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u044b \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>Proxy#newProxyInstance<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0438\u043f\u0430 <code>java.lang.Object<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u044f\u0432\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0442\u0438\u043f \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 &#171;\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0430\u0440\u043e\u043b\u0435\u0439&#187;<\/h4>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>PasswordGenerator<\/code> \u0441 \u043e\u0434\u043d\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c <code>getPassword<\/code>:<\/p>\n<ol>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public interface PasswordGenerator {     String getPassword(); } <\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>java.lang.reflect.InvocationHandler<\/code> \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public class PasswordGeneratorInvocationHandler implements InvocationHandler {     private final String password;      public PasswordGeneratorInvocationHandler(int size) {         this.password = generatePassword(size);     }      @Override     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {         if (\"getPassword\".equals(method.getName())) return password;          return method.invoke(password, args);     }      private static String generatePassword(int size) {         \/\/ \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u043f\u0443\u0449\u0435\u043d\u0430     }  } <\/code><\/pre>\n<p>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p><code>PasswordGeneratorInvocationHandler<\/code> \u043c\u043e\u0436\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0430\u0440\u043e\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>PasswordGeneratorInvocationHandler<\/code> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>generatePassword<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>generatePassword<\/code> \u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u0432 \u0446\u0435\u043b\u044f\u0445 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u043c\u0435\u0441\u0442\u0430, \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/neshkeev\/spring-proxy-demo\/blob\/master\/src\/main\/java\/com\/github\/neshkeev\/spring\/proxy\/simple\/PasswordGeneratorInvocationHandler.java#L25\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>;<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>PasswordGeneratorInvocationHandler#invoke<\/code> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043a\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0431\u044b\u043b \u0432\u044b\u0437\u0432\u0430\u043d: <\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0431\u044b\u043b \u0432\u044b\u0437\u0432\u0430\u043d \u043c\u0435\u0442\u043e\u0434 <code>getPassword<\/code>, \u0442\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0438\u0437 \u043f\u043e\u043b\u044f <code>password<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 <code>password<\/code>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>getPassword<\/code>, \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u043d\u0430 \u0431\u0430\u0437\u0435 <code>PasswordGeneratorInvocationHandler<\/code>, \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<ol start=\"3\">\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public PasswordGenerator passwordGenerator() {     return (PasswordGenerator) Proxy.newProxyInstance(         PasswordGeneratorInvocationHandler.class.getClassLoader(),         new Class[]{PasswordGenerator.class},         new PasswordGeneratorInvocationHandler(32)); } <\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u0434\u0430\u043d\u0438\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u0440\u0430\u043d\u0435\u0435, \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 <code>PasswordGenerator<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0431\u044b\u043b \u0432\u044b\u0437\u0432\u0430\u043d <code>generatePassword<\/code>. \u0412 \u0446\u0435\u043b\u044f\u0445 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u041a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c <code>PasswordGeneratorInvocationHandler<\/code>, \u0447\u0442\u043e\u0431\u044b \u043c\u0435\u0442\u043e\u0434 <code>getPassword<\/code> \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0430 \u043f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u043e\u043a\u0441\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <code>IllegalStateException(\"Password has already been shown\")<\/code>?<\/p>\n<\/div>\n<\/details>\n<h4>\u041f\u0440\u043e\u043a\u0441\u0438 \u043a\u0430\u043a \u043e\u0431\u0451\u0440\u0442\u043a\u0430<\/h4>\n<p>\u041f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043e\u0431\u0451\u0440\u0442\u043a\u0430\u043c\u0438 \u043d\u0430\u0434 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438. \u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0432 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430:<\/p>\n<ul>\n<li>\n<p>\u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u0430, \u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u0433\u043e\u0434\u0438\u0442\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f <code>final<\/code> \u043a\u043b\u0430\u0441\u0441\u043e\u0432);<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (\u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043c\u0435\u0442\u0440\u0438\u043a\u0438), \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0430\u0441\u043f\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ul>\n<li>\n<p>\u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442,<\/p>\n<\/li>\n<li>\n<p>\u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>invoke<\/code> \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0433\u043e\u0442\u043e\u0432\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443,<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434 \u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0442\u043e\u0433\u0434\u0430:<\/p>\n<ol>\n<li>\n<p>\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>InvocationHandler<\/code> \u0434\u043b\u044f \u043e\u0431\u0435\u0440\u0442\u043a\u0438:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public class LoggerWrapperInvocationHandler&lt;T> implements InvocationHandler {     private final static Logger LOG = LoggerFactory.getLogger(LoggerWrapperInvocationHandler.class);      private final T delegate;      public LoggerWrapperInvocationHandler(T delegate) {         this.delegate = delegate;     }      @Override     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {         LOG.info(\"Start executing {}\", method.getName());         final var start = LocalDateTime.now();         try {             return method.invoke(delegate, args);         }         finally {             final var end = LocalDateTime.now();             LOG.info(\"End executing {} which took {}ns\",                 method.getName(),                 Duration.between(start, end).toNanos());         }     } } <\/code><\/pre>\n<p>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043a\u043b\u0430\u0441\u0441 <code>LoggerWrapperInvocationHandler<\/code> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d \u0442\u0438\u043f\u043e\u043c \u043e\u0431\u0451\u0440\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430,<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>invoke<\/code> \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 <code>delegate<\/code>,<\/p>\n<\/li>\n<li>\n<p>\u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0444\u0430\u043a\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u0439\u043c\u0435\u0440,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u043c \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<\/li>\n<\/ul>\n<ol start=\"2\">\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">public&lt;K, V> Map&lt;K, V> wrappedMap(Map&lt;K, V> map) {     \/\/noinspection unchecked     return (Map&lt;K, V>) Proxy.newProxyInstance(         LoggerWrapperInvocationHandler.class.getClassLoader(),         new Class[]{Map.class},         new LoggerWrapperInvocationHandler&lt;>(map)); <\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d \u043a\u043e\u0434\u0443 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432, \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>wrappedMap<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>map<\/code> \u0442\u0438\u043f\u0430 <code>Map&lt;K, V><\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>Map<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u044a\u0435\u043a\u0442 <code>map<\/code> \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <code>LoggerWrapperInvocationHandler<\/code>.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u0440\u043e\u043a\u0441\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 Spring Framework<\/h2>\n<p>Spring \u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u0430\u043a \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 <code>@Repository<\/code>: \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432 \u0441\u0432\u043e\u0435\u043c <\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-350900","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=350900"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350900\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=350900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=350900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=350900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}