{"id":373570,"date":"2024-05-21T05:39:20","date_gmt":"2024-05-21T05:39:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=373570"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=373570","title":{"rendered":"<span>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 Micronaut \u0438 Kotlin<\/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<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 REST-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u201c\u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u201d \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438. \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 Kotlin \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445: Reactor \u0438 \u0421oroutines. \u0414\u043e\u0431\u0430\u0432\u043b\u044e \u0447\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0451,  \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0438 \u043a SpringBoot.<\/p>\n<h2>Micronaut<\/h2>\n<p>Micronaut \u2014 \u044d\u0442\u043e JVM-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u044d\u0442\u043e JVM-\u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 Java, Kotlin \u0438\u043b\u0438 Groovy. \u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0413\u0440\u044d\u043c \u0420\u043e\u0448\u0435 (Graeme Rocher). \u041e\u043d \u0441\u043e\u0437\u0434\u0430\u043b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 Grails \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Micronaut. Micronaut \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<ul>\n<li>\n<p>\u0411\u044b\u0441\u0442\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>\u041d\u0438\u0437\u043a\u043e\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438<\/p>\n<\/li>\n<li>\n<p>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Micronaut<\/h2>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Micronaut.<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/codingwithmohit.com\/micronaut\/micronaut-with-kotlin-coroutines\/%22https:\/\/micronaut.io\/download.html%22\" rel=\"noopener noreferrer nofollow\"><u>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/codingwithmohit.com\/micronaut\/micronaut-with-kotlin-coroutines\/%22https:\/\/www.jetbrains.com\/help\/idea\/micronaut.html%22\" rel=\"noopener noreferrer nofollow\"><u>\u041f\u043b\u0430\u0433\u0438\u043d Intellij<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/codingwithmohit.com\/micronaut\/micronaut-with-kotlin-coroutines\/%22https:\/\/micronaut.io\/launch\/%22\" rel=\"noopener noreferrer nofollow\"><u>Mircronaut Launch<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<h2>\u0421\u0443\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 Micronaut \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 REST API \u0441 CRUD-\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSql. \u0421\u0435\u0440\u0432\u0438\u0441 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445: 1) \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f JVM-\u0441\u0431\u043e\u0440\u043a\u0430 2) \u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u043d\u0430\u043c \u043b\u044e\u0431\u044f\u0449\u0438\u043c Java(Kotlin), \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438.<\/p>\n<p>\u042f \u0432\u044b\u0431\u0440\u0430\u043b \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c &#171;\u0421\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0438&#187;. \u041d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u044d\u0442\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u043a\u043b\u044e\u0447, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u043d\u0435\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0417\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: &#171;\u0442\u0438\u043f\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432&#187; : { &#171;\u041f\u0430\u0441\u043f\u043e\u0440\u0442 \u0420\u0424&#187;, &#171;\u0421\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u043e \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0438&#187; \u0438 \u0442\u0434 }, &#171;\u0422\u0438\u043f\u044b \u0432\u0430\u043b\u044e\u0442&#187;: { &#171;\u0420\u0443\u0431\u043b\u044c&#187;, &#171;\u0414\u043e\u043b\u043b\u0430\u0440&#187;, &#171;\u0415\u0432\u0440\u043e&#187;, \u0438 \u0434\u0440 }.\u00a0\u041f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0441\u0442\u0438 \u043c\u043d\u043e\u0433\u043e. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430 &#171;\u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c&#187;, \u043d\u0435 &#171;\u0445\u0430\u0440\u0434\u043a\u043e\u0434\u044f\u0442\u0441\u044f&#187; \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u043c\u0438 \u0438\u0437 \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430\u043c\u0438 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c.  \u0422.\u0435. \u044d\u0442\u043e \u043d\u0435\u043a\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0434\u0432\u0443\u0445\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0433\u0434\u0435 \u043d\u0430 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0430 \u043d\u0430 \u043f\u043e\u0434\u0447\u0438\u043d\u0435\u043d\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 &#8212; \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. <\/p>\n<p>\u041a\u043e\u0434 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044e, \u0447\u0442\u043e \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u044b \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u043c \u0432 \u0447\u0430\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u0438 \u043a SpringBoot, \u0442\u0430\u043a \u043a\u0430\u043a REST-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b SpringBoot \u0438 Micronaut \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b.\u00a0 <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0443\u0447\u0435\u0431\u043d\u044b\u0439, \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e\u0449\u0438\u0439 \u043d\u0430 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u201c\u0447\u0438\u0441\u0442\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b\u201d, \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0443-\u0442\u043e \u0438 \u0441\u043f\u043e\u0440\u043d\u043e\u0439. <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u0443\u043c\u0435\u0442\u044c \u0441\u0430\u043c\u043e\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f: \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f  \u043f\u043e \u0435\u0433\u043e  endpoit-\u0430\u043c, \u0442.\u0435. \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0441\u0443\u0442\u0435\u0432\u044b\u0445 endpoit-\u043e\u0432\u00a0 \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435 swagger (OpenApi).<\/p>\n<h2>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (PostgreSql)<\/h2>\n<p>\u0417\u0430\u043f\u0438\u0441\u0438 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSql. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 &#8212; \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u201c\u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0438\u201d \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435. <\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"pgsql\">CREATE TABLE public.\"dictionary\" (     id int PRIMARY KEY GENERATED BY DEFAULT AS identity,     \"name\" varchar(255)  NOT NULL,     CONSTRAINT unique_name UNIQUE (\"name\") );  CREATE TABLE public.dictionary_value (     id int PRIMARY KEY GENERATED BY DEFAULT AS identity,     code          varchar(255)  NOT NULL,     value         varchar(255)  NOT NULL,     dictionary_id int NULL references public.\"dictionary\" (id) );<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a88\/d1a\/bb6\/a88d1abb6f2a18f5326bc1a54c00686f.png\" alt=\"\" title=\"\" width=\"344\" height=\"370\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a88\/d1a\/bb6\/a88d1abb6f2a18f5326bc1a54c00686f.png\"\/><\/figure>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Micronaut<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 Micronaut \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 feature:<\/p>\n<ul>\n<li>\n<p>data-r2dbc<\/p>\n<\/li>\n<li>\n<p>r2dbc<\/p>\n<\/li>\n<li>\n<p>postgres<\/p>\n<\/li>\n<li>\n<p>http-client<\/p>\n<\/li>\n<li>\n<p>kapt<\/p>\n<\/li>\n<li>\n<p>kotlin-extension-function <\/p>\n<\/li>\n<li>\n<p>micronaut-aot<\/p>\n<\/li>\n<li>\n<p>micronaut-http-validation<\/p>\n<\/li>\n<li>\n<p>netty-server<\/p>\n<\/li>\n<li>\n<p>openapi<\/p>\n<\/li>\n<li>\n<p>reactor<\/p>\n<\/li>\n<li>\n<p>reactor-http-client<\/p>\n<\/li>\n<li>\n<p>serialization-jackson<\/p>\n<\/li>\n<li>\n<p>swagger-ui<\/p>\n<\/li>\n<li>\n<p>yaml<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/06d\/3ef\/b2a\/06d3efb2a5b25d9c2e1ef112a1c3214e.png\" alt=\"\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0430\u043f\u043e\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430\" title=\"\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0430\u043f\u043e\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430\" width=\"530\" height=\"1221\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/06d\/3ef\/b2a\/06d3efb2a5b25d9c2e1ef112a1c3214e.png\"\/><\/p>\n<div><figcaption>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0430\u043f\u043e\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0412 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 &#171;\u0447\u0438\u0441\u0442\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b&#187;<\/p>\n<h3>\u041a\u043b\u0430\u0441\u0441\u044b \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/h3>\n<pre><code class=\"kotlin\">@Serdeable data class Dictionary(     val id: Long?,     @Size(max = 255) val name: String,     val values: List&lt;DictionaryValue>, ) {     constructor(id: Long? = null, name: String) : this(id, name, emptyList()) } <\/code><\/pre>\n<pre><code class=\"kotlin\">@Serdeable data class DictionaryValue(     val id: Long = 0L,     @JsonProperty(\"parent_id\")     val parentId: Long,     @Size(max = 80) val code: String,     @Size(max = 255) val value: String, )  @Serdeable data class ShortDictionaryValue(     @JsonProperty(\"parent_id\")     val parentId: Long,     @Size(max = 80) val code: String,     @Size(max = 255) val value: String, )<\/code><\/pre>\n<p>\u042f \u043d\u0435 \u0441\u0442\u0430\u043b \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c \u043a\u043e\u0434 \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043b \u043c\u043e\u0434\u0435\u043b\u044c \u0438 dto-\u0448\u043a\u0438.<\/p>\n<p>\u0410\u043d\u043d\u0442\u043e\u043d\u0442\u0430\u0446\u0438\u044f @Serdeable \u00a0 \u043d\u0443\u0436\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u043b\u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u0438\u043f\u0430.  \u041e \u043e\u0431 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Micronaut  \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 Jackson Databind \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/micronaut-projects.github.io\/micronaut-serialization\/latest\/guide\/\" rel=\"noopener noreferrer nofollow\"><u>Micronaut Serialization<\/u><\/a> .<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 &#171;ShortDictionaryValue&#187; \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0441\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0440\u0438  \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044f. \u041d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a\u0438\u043c\u0438-\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 &#171;\u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c&#187; \u043b\u0438\u0448\u043d\u0435\u0435 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0435 &#171;val id: Long&#187;. \u0418 OpenApi \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 &#171;swager&#187; \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c. \u042d\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u0451\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445. <\/p>\n<h3>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/h3>\n<h4>Reactor<\/h4>\n<pre><code class=\"kotlin\">interface ReactorStorageService&lt;M, K> {     fun findAll(): Flux&lt;M>     fun findAll(pageable: Pageable): Mono&lt;Page&lt;M>>     fun save(obj: M): Mono&lt;M?>     fun get(id: K): Mono&lt;M?>     fun update(obj: M): Mono&lt;M>     fun delete(id: K): Mono&lt;K?> }<\/code><\/pre>\n<pre><code class=\"kotlin\">interface ReactorStorageChildrenService&lt;C, K> {     fun findAllByDictionaryId(id: K): Flux&lt;C> }<\/code><\/pre>\n<h4>Coroutine<\/h4>\n<pre><code class=\"kotlin\">interface CoStorageService&lt;M, K> {     fun findAll(): Flow&lt;M>     suspend fun findAll(pageable: Pageable): Page&lt;M>     suspend fun save(obj: M): M     suspend fun get(id: K): M?     suspend fun update(obj: M): M     suspend fun delete(id: K): K }<\/code><\/pre>\n<pre><code class=\"kotlin\">interface CoStorageChildrenService&lt;C, K> {     suspend fun findAllByDictionaryId(id: K): Flow&lt;C> }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 Reactor vs Coroutine:<\/p>\n<pre><code class=\"kotlin\">fun noResultFunc(): Mono&lt;Void> suspend fun noResultFunc()<\/code><\/pre>\n<pre><code class=\"kotlin\">fun singleItemResultFunc(): Mono&lt;T> fun singleItemResultFunc(): T?<\/code><\/pre>\n<pre><code class=\"kotlin\">fun multiItemsResultFunc(): Flux&lt;T> fun mutliItemsResultFunc(): Flow&lt;T><\/code><\/pre>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/h3>\n<p>\u0412\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 &#8212; \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 (\u043f\u0430\u043a\u0435\u0442\u0435).<\/p>\n<h4>\u041a\u043b\u0430\u0441\u0441\u044b-\u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0421\u0423\u0411\u0414<\/h4>\n<pre><code class=\"kotlin\">@Serdeable @MappedEntity(value = \"dictionary\") data class DictionaryDb(     @GeneratedValue     @field:Id val id: Long? = null,     @Size(max = 255) val name: String, )  @Serdeable @MappedEntity(value = \"dictionary_value\") data class DictionaryValueDb(     @GeneratedValue     @field:Id val id: Long? = null,     @Size(max = 80) val code: String,     @Size(max = 255) val value: String,     @MappedProperty(value = \"dictionary_id\")     @JsonProperty(value = \"dictionary_id\")     val dictionaryId: Long, )<\/code><\/pre>\n<h3>\u041a\u043b\u0430\u0441\u0441\u044b-&#171;\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438&#187; <\/h3>\n<p>Coroutine:<\/p>\n<pre><code class=\"kotlin\">@R2dbcRepository(dialect = Dialect.POSTGRES) abstract class CoDictionaryRepository : CoroutinePageableCrudRepository&lt;DictionaryDb, Long> {     @Query(\"SELECT * FROM public.dictionary where id = :id;\")     abstract fun findByDictionaryId(id: Long): Flow&lt;DictionaryDb> }<\/code><\/pre>\n<pre><code class=\"kotlin\">@R2dbcRepository(dialect = Dialect.POSTGRES) abstract class CoDictionaryValueRepository : CoroutinePageableCrudRepository&lt;DictionaryValueDb, Long> {      @Query(\"SELECT * FROM public.dictionary_value where dictionary_id = :id;\")     abstract fun findAllByDictionaryId(id: Long): Flow&lt;DictionaryValueDb> }<\/code><\/pre>\n<p>Reactor<\/p>\n<pre><code class=\"kotlin\">@R2dbcRepository(dialect = Dialect.POSTGRES) abstract class DictionaryRepository : ReactorPageableRepository&lt;DictionaryDb, Long><\/code><\/pre>\n<pre><code class=\"kotlin\">@R2dbcRepository(dialect = Dialect.POSTGRES) abstract class DictionaryValueRepository : ReactorPageableRepository&lt;DictionaryValueDb, Long> {      @Query(\"SELECT * FROM public.dictionary_value where dictionary_id = :id;\")     abstract fun findAllByDictionaryId(id: Long): Flux&lt;DictionaryValueDb>      @Query(\"SELECT * FROM public.dictionary_value where dictionary_id = :dictionaryId and code = :code;\")     abstract fun findByCodeAndDictionaryId(         code: String,         dictionaryId: Long,     ): Mono&lt;DictionaryValueDb> }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0445\u043e\u0436\u0435\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0441 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0432 SpringBoot.<\/p>\n<p>\u041d\u0443 \u0438 \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414 &#8212; \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 (\u0430\u043d\u043d\u043e\u0442\u043e\u0446\u0438\u044f @R2dbcRepository)<\/p>\n<h4>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/h4>\n<p>\u0414\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<pre><code class=\"kotlin\">@Singleton class DictionaryService(private val repository: DictionaryRepository) : ReactorStorageService&lt;Dictionary, Long> {      override fun findAll(pageable: Pageable): Mono&lt;Page&lt;Dictionary>> =         repository.findAll(pageable).map {             it.map { itDict ->                 itDict.toResponse()             }         }      override fun findAll(): Flux&lt;Dictionary> = repository.findAll().map { it.toResponse() }     override fun save(obj: Dictionary): Mono&lt;Dictionary?> = repository.save(obj.toDb()).mapNotNull { it.toResponse() }     override fun get(id: Long): Mono&lt;Dictionary?> = repository.findById(id).map { it.toResponse() }     override fun update(obj: Dictionary): Mono&lt;Dictionary> = repository.update(obj.toDb()).map { it.toResponse() }     override fun delete(id: Long): Mono&lt;Long?> = repository.deleteById(id) }<\/code><\/pre>\n<pre><code class=\"kotlin\">@Singleton class CoDictionaryValueService(private val repository: CoDictionaryValueRepository) :     CoStorageService&lt;DictionaryValue, Long>, CoStorageChildrenService&lt;DictionaryValue, Long> {      override fun findAll(): Flow&lt;DictionaryValue> = repository.findAll().map { it.toResponse() }     override suspend fun findAll(pageable: Pageable): Page&lt;DictionaryValue> = repository.findAll(pageable).map {         it.toResponse()     }     override suspend fun delete(id: Long): Long = repository.deleteById(id).toLong()     override suspend fun update(obj: DictionaryValue): DictionaryValue = repository.update(obj.toDb()).toResponse()     override suspend fun get(id: Long): DictionaryValue? = repository.findById(id)?.toResponse()     override suspend fun save(obj: DictionaryValue): DictionaryValue = repository.save(obj.toDb()).toResponse()      override suspend fun findAllByDictionaryId(id: Long): Flow&lt;DictionaryValue> {         return repository.findAllByDictionaryId(id).map { it.toResponse() }     } }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e Singleton. \u041f\u043e \u0441\u043c\u044b\u0441\u043b\u0443 \u043e\u043d\u0430 \u0431\u043b\u0438\u0437\u043a\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 Service \u0432 SpringBoot. \u0418 \u0442\u0430\u043a\u0438\u0445 \u043e\u0442\u043b\u0438\u0447\u0438\u0439 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e. \u0422.\u0435. \u044f \u0435\u0449\u0451 \u0440\u0430\u0437 \u0430\u043a\u0446\u0435\u043d\u0442\u0438\u0440\u0443\u044e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043e\u0431\u0449\u0443\u044e \u0441\u0438\u043b\u044c\u043d\u0443\u044e \u0441\u0445\u043e\u0436\u0435\u0441\u0442\u044c Micronaut \u0438 SpringBoot. \u0418 \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u043b\u0451\u0433\u043a\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0443-\u0442\u043e \u0442\u043e\u0436\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f Micronaut.<\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432<\/h2>\n<p>\u041d\u0435 \u0431\u0443\u0434\u0443 \u0432\u0435\u044c \u043a\u043e\u0434 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0441\u044c \u043d\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b SpringBoot. \u0415\u0449\u0435 \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442: \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0438\u043c\u0435\u044e\u0442 \u0442\u0438\u043f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u0430 \u043d\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0439.  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u044e\u0442 \u043d\u0438 \u043f\u0440\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0443 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0438 \u043f\u0440\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438. <\/p>\n<pre><code class=\"kotlin\">@Controller(\"\/api\/v1\/co-dictionary\") open class CoDictionaryController(     private val service: CoStorageService&lt;Dictionary, Long>,     private val dictionaryValueService: CoStorageChildrenService&lt;DictionaryValue, Long>, ) {      @Get(\"\/list\")     fun findAll(): Flow&lt;Dictionary> = service.findAll()      @Get(\"\/list-pageable\")     open suspend fun list(@Valid pageable: Pageable): Page&lt;Dictionary> = service.findAll(pageable)      @Get(\"\/list-with-values\")     fun getAll(): Flow&lt;Dictionary> {         return service.findAll().mapNotNull(::readDictionary)     }      \/\/ todo \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u044c\u0438     @Get(\"\/stream\")     fun stream(): Flow&lt;Int> =         flowOf(1,2,3)             .onEach { delay(700) }      @Post     suspend fun save(@NotBlank name: String): HttpResponse&lt;Dictionary> {         return createDictionary(service.save(Dictionary(name = name)))     }     \/\/ ...  }<\/code><\/pre>\n<pre><code class=\"kotlin\">@Controller(\"\/api\/v1\/dictionary-value\") class DictionaryValueController(private val dictionaryService: ReactorStorageService&lt;DictionaryValue, Long>) {     @Get(\"\/list-pageable\")     open fun list(@Valid pageable: Pageable): Mono&lt;Page&lt;DictionaryValue>> = dictionaryService.findAll(pageable)      @Get(\"\/list\")     fun findAll(): Flux&lt;DictionaryValue> = dictionaryService.findAll()      @Post     fun save(@NotBlank @Body value: ShortDictionaryValue): Mono&lt;HttpResponse&lt;DictionaryValue>> {         return dictionaryService.save(value.toResponse()).mapNotNull {             createDictionaryValue(it!!)         }     }      @Get(\"\/{id}\")     fun get(id: Long): Mono&lt;DictionaryValue?> = dictionaryService.get(id) \/\/ ... }<\/code><\/pre>\n<p>\u0427\u0430\u0441\u0442\u043e \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u0445\u00a0 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043f\u043e\u0440\u044f\u0442, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043e\u0431\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443? \u0418\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 lazy \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u0423 \u043e\u0431\u043e\u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u0445 \u0435\u0441\u0442\u044c \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b \u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#171;\u0444\u0440\u043e\u043d\u0442\u0443&#187; \u0438\u043d\u043e\u0433\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0438\u043c\u0435\u0442\u044c \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u0440\u0430\u0437\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0443\u0441\u0438\u043b\u0438\u044f \u0438 \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0441\u0442\u0440\u043e\u043d\u0443 \u0431\u044d\u043a\u0430. \u042f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0442\u0430\u043a\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430. \u0412\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e\u0435 \u0438 \u0442\u043e\u043d\u043a\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 Coroutine \u0438 Reactor. \u041d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u042f \u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u044d\u0442\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0438 \u0435\u0451 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430  Coroutine \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">@Get(\"\/list-with-values\")     fun getAll(): Flow&lt;Dictionary> {         return service.findAll().mapNotNull(::readDictionary)     } \/\/ ... private suspend fun readDictionary(dictionary: Dictionary): Dictionary {         if (dictionary.id == null) return dictionary         val values = dictionaryValueService.findAllByDictionaryId(dictionary.id).toList()         if (values.isEmpty()) return dictionary         return dictionary.copy(             values = values         )     }<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430, \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c Flow. \u0414\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 \u0441 Coroutine \u044f \u0435\u0449\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0442\u0430\u043a\u043e\u0439 &#171;\u0431\u0435\u0437\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439&#187; \u043a\u043e\u0434:<\/p>\n<pre><code class=\"kotlin\">\/\/ todo \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u044c\u0438     @Get(\"\/stream\")     fun stream(): Flow&lt;Int> =         flowOf(1,2,3)             .onEach { delay(700) }<\/code><\/pre>\n<p>\u041e\u0442\u0434\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u0442\u0440\u0438\u043c\u0435 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0441\u044b\u043f\u0430\u0435\u043c \ud83d\ude42 .  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h2>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/h2>\n<p>\u0421\u0431\u043e\u0440\u043a\u0443 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445: <\/p>\n<p>1) \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0430 JVM <\/p>\n<p>2) \u041d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 gradle:<\/p>\n<pre><code class=\"bash\">.\/gradlew dockerBuildNative<\/code><\/pre>\n<p>\u041f\u0440\u043e \u0441\u0431\u043e\u0440\u043a\u0443 \u0432 docker-\u043e\u0431\u0440\u0430\u0437 \u0434\u043b\u044f Micronaut \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/guides.micronaut.io\/latest\/micronaut-docker-image-gradle-kotlin.html\" rel=\"noopener noreferrer nofollow\"><u>Building a Docker Image of your Micronaut application<\/u><\/a> <\/p>\n<p>\u0421\u0431\u043e\u0440\u043a\u0443 \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u044f \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u0432 docker-hub \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u043a &#171;pawga777\/micronaut-dictionary:latest&#187;. <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 docker compose \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b (docker-compose.yml):<\/p>\n<pre><code class=\"yaml\">version: '3.5' services:   app:     network_mode: \"host\"     environment:       DB_HOST: localhost       DB_USERNAME: postgres       DB_PASSWORD: ZSE4zse4       DB_NAME: r2-dict-isn       DB_PORT: 5432     image: pawga777\/micronaut-dictionary:latest  <\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a81\/331\/f8b\/a81331f8b4bd95d2cbd36de80ec12364.png\" alt=\"\u0417\u0430\u043f\u0443\u0441\u043a JVM-\u0432\u0435\u0440\u0441\u0438\u0438\" title=\"\u0417\u0430\u043f\u0443\u0441\u043a JVM-\u0432\u0435\u0440\u0441\u0438\u0438\" width=\"1569\" height=\"298\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a81\/331\/f8b\/a81331f8b4bd95d2cbd36de80ec12364.png\"\/><\/p>\n<div><figcaption>\u0417\u0430\u043f\u0443\u0441\u043a JVM-\u0432\u0435\u0440\u0441\u0438\u0438<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dac\/a4d\/908\/daca4d908d664b6e710832be8b8259d2.png\" alt=\"\u0417\u0430\u043f\u0443\u0441\u043a &quot;\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439&quot; \u0432\u0435\u0440\u0441\u0438\u0438\" title=\"\u0417\u0430\u043f\u0443\u0441\u043a &quot;\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439&quot; \u0432\u0435\u0440\u0441\u0438\u0438\" width=\"1797\" height=\"472\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dac\/a4d\/908\/daca4d908d664b6e710832be8b8259d2.png\"\/><\/p>\n<div><figcaption>\u0417\u0430\u043f\u0443\u0441\u043a &#171;\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439&#187; \u0432\u0435\u0440\u0441\u0438\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0442\u0430\u0440\u0442\u0430: 1548ms vs 144ms. \u0412\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u0435\u0442? \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0430 SpringBoot \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 \u043e\u043a\u043e\u043b\u043e 3000ms (Micronaut \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0435\u043c SpringBoot). \u0412 JVM-\u0432\u0435\u0440\u0441\u0438\u0438 Micronaut \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e CRaC, \u0447\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \u0441\u0442\u0430\u0440\u0442\u0430, \u0435\u0441\u043b\u0438 \u043f\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442.  \u041f\u0440\u0438\u043c\u0435\u0440 \u0441 CRaC \u043e\u0442 Micronaut: <a href=\"https:\/\/guides.micronaut.io\/latest\/micronaut-crac-helloworld-gradle-java.html\" rel=\"noopener noreferrer nofollow\"><u>Micronaut CRaC<\/u><\/a> .<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9c6\/28b\/9de\/9c628b9de22a3b16a7b2f443621e2a53.png\" alt=\"Swagger (OpenApi)\" title=\"Swagger (OpenApi)\" width=\"1026\" height=\"1013\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9c6\/28b\/9de\/9c628b9de22a3b16a7b2f443621e2a53.png\"\/><\/p>\n<div><figcaption>Swagger (OpenApi)<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f13\/961\/508\/f13961508c9606c6348eaed98fbd5483.png\" alt=\"\u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\" title=\"\u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\" width=\"1034\" height=\"914\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f13\/961\/508\/f13961508c9606c6348eaed98fbd5483.png\"\/><\/p>\n<div><figcaption>\u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441<\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0436\u0435 Postman \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 &#171;swagger&#187;. <\/p>\n<h2>\u0422\u0435\u0441\u0442\u044b<\/h2>\n<p>\u0422\u0435\u043c\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0448\u0438\u0440\u043d\u0430\u044f. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Kotest. Micronaut \u0443\u043c\u0435\u0435\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e &#171;\u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445&#187; \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432(Testcontainers). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 Micronaut \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 Testcontainers \u043a\u0430\u043a  &#171;Test Resources&#187;. \u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0432 \u0444\u0440\u0430\u0437\u0435 \u0432\u044b\u0448\u0435 &#171;\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438&#187;, \u0442..\u0435 \u043e\u0431\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442. \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 Micronaut, \u0433\u0434\u0435 \u043e\u043d\u0438 \u044d\u0442\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 (\u0421\u0423\u0411\u0414 H2 \u0438 PostgreSQL): <a href=\"https:\/\/guides.micronaut.io\/latest\/replace-h2-with-real-database-for-testing-gradle-java.html\" rel=\"noopener noreferrer nofollow\">REPLACE H2 WITH A REAL DATABASE FOR TESTING<\/a>. \u041d\u043e \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0447\u0442\u043e \u0443 \u043d\u0438\u0445 \u043d\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0430 Kotlin. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0430, \u0442 \u0435.  \u0443 Micronaut \u0435\u0441\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043d\u0430 Kotlin. \u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043f\u043e\u0434\u0445\u043e\u0434 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435.  \u041e\u0431\u0445\u043e\u0434\u0438\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432 \u043c\u043e\u043a\u0430\u043c\u0438:<\/p>\n<pre><code class=\"kotlin\">@MockBean(CoDictionaryRepository::class)     fun mockedPostRepository() = mockk&lt;CoDictionaryRepository>()<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 &#171;\u0440\u0443\u0447\u043a\u0438&#187; \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">given(\"CoDictionaryController\") {         `when`(\"test find all\") {             val repository = getMock(coDictionaryRepository)             coEvery { repository.findAll() }                 .returns(                     flowOf(                         DictionaryDb(                             id = 1,                             name = \"test1\",                         ),                         DictionaryDb(                             id = 2,                             name = \"test2\",                         ),                     )                 )             val response = client.toBlocking().exchange(\"\/list\", Array&lt;Dictionary>::class.java)              then(\"should return OK\") {                 response.status shouldBe HttpStatus.OK                 val list = response.body()!!                 list.size shouldBe 2                 list[0].name shouldBe \"test1\"                 list[1].name shouldBe \"test2\"             }         }<\/code><\/pre>\n<p>\u041c\u044b \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0431\u0435\u0437 \u043c\u043e\u043a\u043e\u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434 (\u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b). <\/p>\n<p>Kotest, \u043a\u0441\u0442\u0430\u0442\u0438, \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0435\u043a\u0443\u044e \u0441\u0432\u043e\u0431\u043e\u0434\u0443. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u0434\u0445\u043e\u0434 BehaviorSpec, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0441\u0442\u0438\u043b\u044f BDD. BehaviorSpec \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c context, given, when, then. \u041d\u043e \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438: FunSpec, AnnotationSpec, ShouldSpec, FeatureSpec \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0418\u0445 \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434. AnnotationSpec, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u0441 JUnit, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0441\u0442\u044b (\u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 Test: <\/p>\n<pre><code class=\"kotlin\">class AnnotationSpecExample : AnnotationSpec() {      @BeforeEach     fun beforeTest() {         println(\"Before each test\")     }      @Test     fun test1() {         1 shouldBe 1     }      @Test     fun test2() {         3 shouldBe 3     } }<\/code><\/pre>\n<p>FunSpec \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e test \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0430\u043c \u0442\u0435\u0441\u0442 \u0432 \u0432\u0438\u0434\u0435 \u043b\u044f\u043c\u0431\u0434\u044b. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044d\u0442\u043e\u0442 \u0441\u0442\u0438\u043b\u044c:<\/p>\n<pre><code class=\"kotlin\">class MyTests : FunSpec({     test(\"String length should return the length of the string\") {         \"sammy\".length shouldBe 5         \"\".length shouldBe 0     } })<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438  \u0432 Micronaut \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/micronaut-projects.github.io\/micronaut-test\/latest\/guide\/#usingMockitoMocks\" rel=\"noopener noreferrer nofollow\">Micronaut Test<\/a><\/p>\n<h2>\u042d\u043f\u0438\u043b\u043e\u0433<\/h2>\n<p>\u041a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435: <a href=\"https:\/\/github.com\/pawga\/micronaut-dictionary\" rel=\"noopener noreferrer nofollow\">micronaut-dictionary<\/a><\/p>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u044f \u0434\u043e\u043a\u0435\u0440-\u043e\u0431\u0440\u0430\u0437 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u0432 docker-hub.<\/p>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0432\u0448\u0438\u043c \u0434\u043e\u00a0\u043a\u043e\u043d\u0446\u0430 \u043c\u043e\u044e \u0441\u0442\u0430\u0442\u044c\u044e\u00a0\u2014 \u0441\u043f\u0430\u0441\u0438\u0431\u043e.<\/p>\n<p>Happy Coding!<\/p>\n<\/p>\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\/807597\/\"> https:\/\/habr.com\/ru\/articles\/807597\/<\/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<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 REST-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u201c\u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u201d \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438. \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 Kotlin \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445: Reactor \u0438 \u0421oroutines. \u0414\u043e\u0431\u0430\u0432\u043b\u044e \u0447\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0451,  \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0438 \u043a SpringBoot.<\/p>\n<h2>Micronaut<\/h2>\n<p>Micronaut \u2014 \u044d\u0442\u043e JVM-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u044d\u0442\u043e JVM-\u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 Java, Kotlin \u0438\u043b\u0438 Groovy. \u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0413\u0440\u044d\u043c \u0420\u043e\u0448\u0435 (Graeme Rocher). \u041e\u043d \u0441\u043e\u0437\u0434\u0430\u043b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 Grails \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Micronaut. Micronaut \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<ul>\n<li>\n<p>\u0411\u044b\u0441\u0442\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>\u041d\u0438\u0437\u043a\u043e\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438<\/p>\n<\/li>\n<li>\n<p>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Micronaut<\/h2>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Micronaut.<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/codingwithmohit.com\/micronaut\/micronaut-with-kotlin-coroutines\/%22https:\/\/micronaut.io\/download.html%22\" rel=\"noopener noreferrer nofollow\"><u>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/codingwithmohit.com\/micronaut\/micronaut-with-kotlin-coroutines\/%22https:\/\/www.jetbrains.com\/help\/idea\/micronaut.html%22\" rel=\"noopener noreferrer nofollow\"><u>\u041f\u043b\u0430\u0433\u0438\u043d Intellij<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/codingwithmohit.com\/micronaut\/micronaut-with-kotlin-coroutines\/%22https:\/\/micronaut.io\/launch\/%22\" rel=\"noopener noreferrer nofollow\"><u>Mircronaut Launch<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<h2>\u0421\u0443\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 Micronaut \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 REST API \u0441 CRUD-\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSql. \u0421\u0435\u0440\u0432\u0438\u0441 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445: 1) \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f JVM-\u0441\u0431\u043e\u0440\u043a\u0430 2) \u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u043d\u0430\u043c \u043b\u044e\u0431\u044f\u0449\u0438\u043c Java(Kotlin), \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438.<\/p>\n<p>\u042f \u0432\u044b\u0431\u0440\u0430\u043b \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c &#171;\u0421\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0438&#187;. \u041d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u044d\u0442\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u043a\u043b\u044e\u0447, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u043d\u0435\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0417\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: &#171;\u0442\u0438\u043f\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432&#187; : { &#171;\u041f\u0430\u0441\u043f\u043e\u0440\u0442 \u0420\u0424&#187;, &#171;\u0421\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u043e \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0438&#187; \u0438 \u0442\u0434 }, &#171;\u0422\u0438\u043f\u044b \u0432\u0430\u043b\u044e\u0442&#187;: { &#171;\u0420\u0443\u0431\u043b\u044c&#187;, &#171;\u0414\u043e\u043b\u043b\u0430\u0440&#187;, &#171;\u0415\u0432\u0440\u043e&#187;, \u0438 \u0434\u0440 }.\u00a0\u041f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0441\u0442\u0438 \u043c\u043d\u043e\u0433\u043e. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430 &#171;\u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c&#187;, \u043d\u0435 &#171;\u0445\u0430\u0440\u0434\u043a\u043e\u0434\u044f\u0442\u0441\u044f&#187; \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u043c\u0438 \u0438\u0437 \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430\u043c\u0438 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c.  \u0422.\u0435. \u044d\u0442\u043e \u043d\u0435\u043a\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0434\u0432\u0443\u0445\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0433\u0434\u0435 \u043d\u0430 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0430 \u043d\u0430 \u043f\u043e\u0434\u0447\u0438\u043d\u0435\u043d\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 &#8212; \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. <\/p>\n<p>\u041a\u043e\u0434 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044e, \u0447\u0442\u043e \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u044b \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u043c \u0432 \u0447\u0430\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u0438 \u043a SpringBoot, \u0442\u0430\u043a \u043a\u0430\u043a REST-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b SpringBoot \u0438 Micronaut \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b.\u00a0 <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0443\u0447\u0435\u0431\u043d\u044b\u0439, \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e\u0449\u0438\u0439 \u043d\u0430 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u201c\u0447\u0438\u0441\u0442\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b\u201d, \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0443-\u0442\u043e \u0438 \u0441\u043f\u043e\u0440\u043d\u043e\u0439. <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u0443\u043c\u0435\u0442\u044c \u0441\u0430\u043c\u043e\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f: \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f  \u043f\u043e \u0435\u0433\u043e  endpoit-\u0430\u043c, \u0442.\u0435. \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0441\u0443\u0442\u0435\u0432\u044b\u0445 endpoit-\u043e\u0432\u00a0 \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435 swagger (OpenApi).<\/p>\n<h2>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (PostgreSql)<\/h2>\n<p>\u0417\u0430\u043f\u0438\u0441\u0438 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSql. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 &#8212; \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u201c\u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0438\u201d \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435. <\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"pgsql\">CREATE TABLE public.\"dictionary\" (     id int PRIMARY KEY GENERATED BY DEFAULT AS identity,     \"name\" varchar(255)  NOT NULL,     CONSTRAINT unique_name UNIQUE (\"name\") );  CREATE TABLE public.dictionary_value (     id int PRIMARY KEY GENERATED BY DEFAULT AS identity,     code          varchar(255)  NOT NULL,     value         varchar(255)  NOT NULL,     dictionary_id int NULL references public.\"dictionary\" (id) );<\/code><\/pre>\n<figure class=\"\"><\/figure>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Micronaut<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 Micronaut \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 feature:<\/p>\n<ul>\n<li>\n<p>data-r2dbc<\/p>\n<\/li>\n<li>\n<p>r2dbc<\/p>\n<\/li>\n<li>\n<p>postgres<\/p>\n<\/li>\n<li>\n<p>http-client<\/p>\n<\/li>\n<li>\n<p>kapt<\/p>\n<\/li>\n<li>\n<p>kotlin-extension-function <\/p>\n<\/li>\n<li>\n<p>micronaut-aot<\/p>\n<\/li>\n<li>\n<p>micronaut-http-validation<\/p>\n<\/li>\n<li>\n<p>netty-server<\/p>\n<\/li>\n<li>\n<p>openapi<\/p>\n<\/li>\n<li>\n<p>reactor<\/p>\n<\/li>\n<li>\n<p>reactor-http-client<\/p>\n<\/li>\n<li>\n<p>serialization-jackson<\/p>\n<\/li>\n<li>\n<p>swagger-ui<\/p>\n<\/li>\n<li>\n<p>yaml<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0430\u043f\u043e\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0412 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 &#171;\u0447\u0438\u0441\u0442\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b&#187;<\/p>\n<h3>\u041a\u043b\u0430\u0441\u0441\u044b \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/h3>\n<pre><code class=\"kotlin\">@Serdeable data class Dictionary(     val id: Long?,     @Size(max = 255) val name: String,     val values: List&lt;DictionaryValue>, ) {     constructor(id: Long? = null, name: String) : this(id, name, emptyList()) } <\/code><\/pre>\n<pre><code class=\"kotlin\">@Serdeable data class DictionaryValue(     val id: Long = 0L,     @JsonProperty(\"parent_id\")     val parentId: Long,     @Size(max = 80) val code: String,     @Size(max = 255) val value: String, )  @Serdeable data class ShortDictionaryValue(     @JsonProperty(\"parent_id\")     val parentId: Long,     @Size(max = 80) val code: String,     @Size(max = 255) val value: String, )<\/code><\/pre>\n<p>\u042f \u043d\u0435 \u0441\u0442\u0430\u043b \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c \u043a\u043e\u0434 \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043b \u043c\u043e\u0434\u0435\u043b\u044c \u0438 dto-\u0448\u043a\u0438.<\/p>\n<p>\u0410\u043d\u043d\u0442\u043e\u043d\u0442\u0430\u0446\u0438\u044f @Serdeable \u00a0 \u043d\u0443\u0436\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u043b\u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u0438\u043f\u0430.  \u041e \u043e\u0431 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Micronaut  \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 Jackson Databind \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/micronaut-projects.github.io\/micronaut-serialization\/latest\/guide\/\" rel=\"noopener noreferrer nofollow\"><u>Micronaut Serialization<\/u><\/a> .<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 &#171;ShortDictionaryValue&#187; \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0441\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0440\u0438  \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044f. \u041d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a\u0438\u043c\u0438-\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 &#171;\u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c&#187; \u043b\u0438\u0448\u043d\u0435\u0435 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0435 &#171;val id: Long&#187;. \u0418 OpenApi \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 &#171;swager&#187; \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c. \u042d\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u0451\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445. <\/p>\n<h3>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/h3>\n<h4>Reactor<\/h4>\n<pre><code class=\"kotlin\">interface ReactorStorageService&lt;M, K> {     fun findAll(): Flux&lt;M>     fun findAll(pageable: Pageable): Mono&lt;Page&lt;M>>     fun save(obj: M): Mono&lt;M?>     fun get(id: K): Mono&lt;M?>     fun update(obj: M): Mono&lt;M>     fun delete(id: K): Mono&lt;K?> }<\/code><\/pre>\n<pre><code class=\"kotlin\">interface ReactorStorageChildrenService&lt;C, K> {     fun findAllByDictionaryId(id: K): Flux&lt;C> }<\/code><\/pre>\n<h4>Coroutine<\/h4>\n<pre><code class=\"kotlin\">interface CoStorageService&lt;M, K> {     fun findAll(): Flow&lt;M>     suspend fun findAll(pageable: Pageable): Page&lt;M>     suspend fun save(obj: M): M     suspend fun get(id: K): M?     suspend fun update(obj: M): M     suspend fun delete(id: K): K }<\/code><\/pre>\n<pre><code class=\"kotlin\">interface CoStorageChildrenService&lt;C, K> {     suspend fun findAllByDictionaryId(id: K): Flow&lt;C> }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 Reactor vs Coroutine:<\/p>\n<pre><code class=\"kotlin\">fun noResultFunc(): Mono&lt;Void> suspend fun noResultFunc()<\/code><\/pre>\n<pre><code class=\"kotlin\">fun singleItemResultFunc(): Mono&lt;T> fun singleItemResultFunc(): T?<\/code><\/pre>\n<pre><code class=\"kotlin\">fun multiItemsResultFunc(): Flux&lt;T> fun mutliItemsResultFunc(): Flow&lt;T><\/code><\/pre>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/h3>\n<p>\u0412\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 &#8212; \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 (\u043f\u0430\u043a\u0435\u0442\u0435).<\/p>\n<h4>\u041a\u043b\u0430\u0441\u0441\u044b-\u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0421\u0423\u0411\u0414<\/h4>\n<pre><code class=\"kotlin\">@Serdeable @MappedEntity(value = \"dictionary\") data class DictionaryDb(     @GeneratedValue     @field:Id val id: Long? = null,     @Size(max = 255) val name: String, )  @Serdeable @MappedEntity(value = \"dictionary_value\") data class DictionaryValueDb(     @GeneratedValue     @field:Id val id: Long? = null,     @Size(max = 80) val code: String,     @Size(max = 255) val value: String,     @MappedProperty(value = \"dictionary_id\")     @JsonProperty(value = \"dictionary_id\")     val dictionaryId: Long, )<\/code><\/pre>\n<h3>\u041a\u043b\u0430\u0441\u0441\u044b-&#171;\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438&#187; <\/h3>\n<p>Coroutine:<\/p>\n<pre><code class=\"kotlin\">@R2dbcRepository(dialect = Dialect.POSTGRES) abstract class CoDictionaryRepository : CoroutinePageableCrudRepository&lt;DictionaryDb, Long> {     @Query(\"SELECT * FROM public.dictionary where id = :id;\")     abstract fun findByDictionaryId(id: Long): Flow&lt;DictionaryDb> }<\/code><\/pre>\n<pre><code class=\"kotlin\">@R2dbcRepository(dialect = Dialect.POSTGRES) abstract class CoDictionaryValueRepository : CoroutinePageableCrudRepository&lt;DictionaryValueDb, Long> {      @Query(\"SELECT * FROM public.dictionary_value where dictionary_id = :id;\")     abstract fun findAllByDictionaryId(id: Long): Flow&lt;DictionaryValueDb> }<\/code><\/pre>\n<p>Reactor<\/p>\n<pre><code class=\"kotlin\">@R2dbcRepository(dialect = Dialect.POSTGRES) abstract class DictionaryRepository : ReactorPageableRepository&lt;DictionaryDb, Long><\/code><\/pre>\n<pre><code class=\"kotlin\">@R2dbcRepository(dialect = Dialect.POSTGRES) abstract class DictionaryValueRepository : ReactorPageableRepository&lt;DictionaryValueDb, Long> {      @Query(\"SELECT * FROM public.dictionary_value where dictionary_id = :id;\")     abstract fun findAllByDictionaryId(id: Long): Flux&lt;DictionaryValueDb>      @Query(\"SELECT * FROM public.dictionary_value where dictionary_id = :dictionaryId and code = :code;\")     abstract fun findByCodeAndDictionaryId(         code: String,         dictionaryId: Long,     ): Mono&lt;DictionaryValueDb> }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0445\u043e\u0436\u0435\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0441 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0432 SpringBoot.<\/p>\n<p>\u041d\u0443 \u0438 \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414 &#8212; \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 (\u0430\u043d\u043d\u043e\u0442\u043e\u0446\u0438\u044f @R2dbcRepository)<\/p>\n<h4>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/h4>\n<p>\u0414\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<pre><code class=\"kotlin\">@Singleton class DictionaryService(private val repository: DictionaryRepository) : ReactorStorageService&lt;Dictionary, Long> {      override fun findAll(pageable: Pageable): Mono&lt;Page&lt;Dictionary>> =         repository.findAll(pageable).map {             it.map { itDict ->                 itDict.toResponse()             }         }      override fun findAll(): Flux&lt;Dictionary> = repository.findAll().map { it.toResponse() }     override fun save(obj: Dictionary): Mono&lt;Dictionary?> = repository.save(obj.toDb()).mapNotNull { it.toResponse() }     override fun get(id: Long): Mono&lt;Dictionary?> = repository.findById(id).map { it.toResponse() }     override fun update(obj: Dictionary): Mono&lt;Dictionary> = repository.update(obj.toDb()).map { it.toResponse() }     override fun delete(id: Long): Mono&lt;Long?> = repository.deleteById(id) }<\/code><\/pre>\n<pre><code class=\"kotlin\">@Singleton class CoDictionaryValueService(private val repository: CoDictionaryValueRepository) :     CoStorageService&lt;DictionaryValue, Long>, CoStorageChildrenService&lt;DictionaryValue, Long> {      override fun findAll(): Flow&lt;DictionaryValue> = repository.findAll().map { it.toResponse() }     override suspend fun findAll(pageable: Pageable): Page&lt;DictionaryValue> = repository.findAll(pageable).map {         it.toResponse()     }     override suspend fun delete(id: Long): Long = repository.deleteById(id).toLong()     override suspend fun update(obj: DictionaryValue): DictionaryValue = repository.update(obj.toDb()).toResponse()     override suspend fun get(id: Long): DictionaryValue? = repository.findById(id)?.toResponse()     override suspend fun save(obj: DictionaryValue): DictionaryValue = repository.save(obj.toDb()).toResponse()      override suspend fun findAllByDictionaryId(id: Long): Flow&lt;DictionaryValue> {         return repository.findAllByDictionaryId(id).map { it.toResponse() }     } }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e Singleton. \u041f\u043e<\/p>\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-373570","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/373570","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=373570"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/373570\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=373570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=373570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=373570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}