{"id":297283,"date":"2020-01-17T15:00:39","date_gmt":"2020-01-17T15:00:39","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=297283"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=297283","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 Quarkus, Kotlin \u0438 Gradle"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/484320\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/b0\/c8\/k8\/b0c8k8k4cxgj8-czvjdrgn6uxgk.jpeg\"><\/p>\n<p>  <\/p>\n<h2 id=\"vvedenie\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0412 <a href=\"https:\/\/romankudryashov.com\/blog\/2020\/01\/heterogeneous-microservices\/\" rel=\"nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 JVM \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0445 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0448\u0435\u0434\u0448\u0438\u0439 <a href=\"https:\/\/quarkus.io\/\" rel=\"nofollow\">Quarkus<\/a> \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u0447\u0430\u0441\u0442\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f09\/7fd\/476\/f097fd47661517c348a85a4d3251ecb4.png\" alt=\"target architecture\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/tree\/master\/quarkus-service\" rel=\"nofollow\">GitHub<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>JDK 13<\/li>\n<li><a href=\"https:\/\/www.consul.io\" rel=\"nofollow\">Consul<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"sozdanie-novogo-proekta\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <a href=\"https:\/\/code.quarkus.io\" rel=\"nofollow\">web starter<\/a> \u0438\u043b\u0438 Maven (\u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <a href=\"https:\/\/quarkus.io\/guides\/getting-started\" rel=\"nofollow\">Maven<\/a> \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u043b\u0438 <a href=\"https:\/\/quarkus.io\/guides\/gradle-tooling\" rel=\"nofollow\">Gradle<\/a> \u043f\u0440\u043e\u0435\u043a\u0442\u0430). \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u044f\u0437\u044b\u043a\u0438 Java, Kotlin \u0438 Scala.<\/p>\n<p>  <\/p>\n<h2 id=\"zavismosti\">\u0417\u0430\u0432\u0438\u0441\u043c\u043e\u0441\u0442\u0438<\/h2>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0431\u043e\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Gradle Kotlin DSL. \u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u0431\u043e\u0440\u043a\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<p>\u043f\u043b\u0430\u0433\u0438\u043d\u044b<br \/>  \u041b\u0438\u0441\u0442\u0438\u043d\u0433 1. <a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/build.gradle.kts\" rel=\"nofollow\">build.gradle.kts<\/a><\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">plugins {     kotlin(&quot;jvm&quot;)     kotlin(&quot;plugin.allopen&quot;)     id(&quot;io.quarkus&quot;) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0439 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 <a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/settings.gradle.kts\" rel=\"nofollow\"><code>settings.gradle.kts<\/code><\/a>.<\/p>\n<p>  <\/li>\n<li>\n<p>\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<br \/>  \u041b\u0438\u0441\u0442\u0438\u043d\u0433 2. <a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/build.gradle.kts\" rel=\"nofollow\">build.gradle.kts<\/a><\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">dependencies {     ...     implementation(enforcedPlatform(&quot;io.quarkus:quarkus-bom:$quarkusVersion&quot;))     implementation(&quot;io.quarkus:quarkus-resteasy-jackson&quot;)     implementation(&quot;io.quarkus:quarkus-rest-client&quot;)     implementation(&quot;io.quarkus:quarkus-kotlin&quot;)     implementation(&quot;io.quarkus:quarkus-config-yaml&quot;)     testImplementation(&quot;io.quarkus:quarkus-junit5&quot;)     ... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 Maven BOM \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432 <a href=\"https:\/\/docs.gradle.org\/current\/userguide\/platforms.html#sub:bom_import\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Gradle<\/a>.<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 Kotlin \u043a\u043b\u0430\u0441\u0441\u044b <code>open<\/code> (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d\u0438 <code>final<\/code>; \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e Gradle \u0432 <a href=\"https:\/\/quarkus.io\/guides\/kotlin#important-gradle-configuration-points\" rel=\"nofollow\">Quarkus Kotlin guide<\/a>:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 3. <a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/build.gradle.kts\" rel=\"nofollow\">build.gradle.kts<\/a><\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">allOpen {     annotation(&quot;javax.enterprise.context.ApplicationScoped&quot;) }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"konfigurirovanie\">\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c properties \u0438 YAML \u0444\u0430\u0439\u043b\u043e\u0432<br \/>  (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0432 <a href=\"https:\/\/quarkus.io\/guides\/config\" rel=\"nofollow\">Quarkus config guide<\/a>). \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 <code>resources<\/code> \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 4. <a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/src\/main\/resources\/application.yaml\" rel=\"nofollow\">application.yaml<\/a><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">quarkus:   http:     host: localhost     port: 8084  application-info:   name: quarkus-service   framework:     name: Quarkus     releaseYear: 2019<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u044b \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 5. \u0427\u0442\u0435\u043d\u0438\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (<a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/src\/main\/kotlin\/io\/heterogeneousmicroservices\/quarkusservice\/config\/ApplicationInfoProperties.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">import io.quarkus.arc.config.ConfigProperties  @ConfigProperties(prefix = &quot;application-info&quot;) class ApplicationInfoProperties {      lateinit var name: String      lateinit var framework: FrameworkConfiguration      class FrameworkConfiguration {         lateinit var name: String         lateinit var releaseYear: String     } }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"biny\">\u0411\u0438\u043d\u044b<\/h2>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043e\u0434\u043e\u043c, \u043d\u0430\u0434\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Quarkus \u043d\u0435\u0442 main \u043c\u0435\u0442\u043e\u0434\u0430 (\u0445\u043e\u0442\u044f, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, <a href=\"https:\/\/github.com\/quarkusio\/quarkus\/issues\/6499\" rel=\"nofollow\">\u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f<\/a>).<\/p>\n<p>  <\/p>\n<p>\u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 <code>@ConfigProperties<\/code> \u0431\u0438\u043d\u0430 \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0431\u0438\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@Inject<\/code>:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 6. \u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 <code>@ConfigProperties<\/code> \u0431\u0438\u043d\u0430 (<a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/src\/main\/kotlin\/io\/heterogeneousmicroservices\/quarkusservice\/service\/ApplicationInfoService.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@ApplicationScoped class ApplicationInfoService(     @Inject private val applicationInfoProperties: ApplicationInfoProperties,     @Inject private val serviceClient: ServiceClient ) {     ... }<\/code><\/pre>\n<p>  <\/p>\n<p><code>ApplicationInfoService<\/code> \u0431\u0438\u043d, \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 <code>@ApplicationScoped<\/code>, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432\u043d\u0435\u0434\u0440\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 7. \u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 <code>@ApplicationScoped<\/code> \u0431\u0438\u043d\u0430 (<a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/src\/main\/kotlin\/io\/heterogeneousmicroservices\/quarkusservice\/web\/ApplicationInfoResource.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">class ApplicationInfoResource(     @Inject private val applicationInfoService: ApplicationInfoService )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e Contexts and Dependency Injection \u0432 <a href=\"https:\/\/quarkus.io\/guides\/cdi-reference\" rel=\"nofollow\">Quarkus CDI guide<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"rest-kontroller\">REST \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440<\/h2>\n<p>  <\/p>\n<p>\u0412 REST \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 Spring Framework \u0438\u043b\u0438 Java EE:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 8. REST \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 (<a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/src\/main\/kotlin\/io\/heterogeneousmicroservices\/quarkusservice\/web\/ApplicationInfoResource.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Path(&quot;\/application-info&quot;) @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) class ApplicationInfoResource(     @Inject private val applicationInfoService: ApplicationInfoService ) {      @GET     fun get(@QueryParam(&quot;request-to&quot;) requestTo: String?): Response =         Response.ok(applicationInfoService.get(requestTo)).build()      @GET     @Path(&quot;\/logo&quot;)     @Produces(&quot;image\/png&quot;)     fun logo(): Response = Response.ok(applicationInfoService.getLogo()).build() }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"rest-klient\">REST \u043a\u043b\u0438\u0435\u043d\u0442<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 Quarkus \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c. \u0422. \u043a. \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 API, \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043f\u0430\u0447\u043a\u0443 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0435\u0433\u043e REST \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 9. REST \u043a\u043b\u0438\u0435\u043d\u0442\u044b (<a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/src\/main\/kotlin\/io\/heterogeneousmicroservices\/quarkusservice\/service\/ExternalServiceClients.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@ApplicationScoped @Path(&quot;\/&quot;) interface ExternalServiceClient {     @GET     @Path(&quot;\/application-info&quot;)     @Produces(&quot;application\/json&quot;)     fun getApplicationInfo(): ApplicationInfo }  @RegisterRestClient(baseUri = &quot;http:\/\/helidon-service&quot;) interface HelidonServiceClient : ExternalServiceClient  @RegisterRestClient(baseUri = &quot;http:\/\/ktor-service&quot;) interface KtorServiceClient : ExternalServiceClient  @RegisterRestClient(baseUri = &quot;http:\/\/micronaut-service&quot;) interface MicronautServiceClient : ExternalServiceClient  @RegisterRestClient(baseUri = &quot;http:\/\/quarkus-service&quot;) interface QuarkusServiceClient : ExternalServiceClient  @RegisterRestClient(baseUri = &quot;http:\/\/spring-boot-service&quot;) interface SpringBootServiceClient : ExternalServiceClient<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 REST \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 JAX-RS \u0438 MicroProfile \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"service-discovery\">Service Discovery<\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0432\u0438\u0434\u043d\u043e \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>baseUri<\/code> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u041d\u043e \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u0432 Quarkus \u043d\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 Service Discovery (<a href=\"https:\/\/github.com\/quarkusio\/quarkus\/issues\/2052\" rel=\"nofollow\">Eureka<\/a>) \u0438\u043b\u0438 \u043e\u043d\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 (<a href=\"https:\/\/github.com\/quarkusio\/quarkus\/issues\/5812\" rel=\"nofollow\">Consul<\/a>), \u0442. \u043a. \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0432 \u043f\u0435\u0440\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0430\u0445. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0430\u0442\u0442\u0435\u0440\u043d Service Discovery \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/rickfast\/consul-client\" rel=\"nofollow\">Consul Client for Java<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442 \u043a Consul \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430, <code>register<\/code> \u0438 <code>getServiceInstance<\/code> (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c Round-robin):<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 10. \u041a\u043b\u0438\u0435\u043d\u0442 \u043a Consul (<a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/src\/main\/kotlin\/io\/heterogeneousmicroservices\/quarkusservice\/servicediscovery\/ConsulClient.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@ApplicationScoped class ConsulClient(     @ConfigProperty(name = &quot;application-info.name&quot;)     private val serviceName: String,     @ConfigProperty(name = &quot;quarkus.http.port&quot;)     private val port: Int ) {      private val consulUrl = &quot;http:\/\/localhost:8500&quot;     private val consulClient by lazy {         Consul.builder().withUrl(consulUrl).build()     }     private var serviceInstanceIndex: Int = 0      fun register() {         consulClient.agentClient().register(createConsulRegistration())     }      fun getServiceInstance(serviceName: String): Service {         val serviceInstances = consulClient.healthClient().getHealthyServiceInstances(serviceName).response         val selectedInstance = serviceInstances[serviceInstanceIndex]         serviceInstanceIndex = (serviceInstanceIndex + 1) % serviceInstances.size         return selectedInstance.service     }      private fun createConsulRegistration() = ImmutableRegistration.builder()         .id(&quot;$serviceName-$port&quot;)         .name(serviceName)         .address(&quot;localhost&quot;)         .port(port)         .build() }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 11. \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0432 Consul (<a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/src\/main\/kotlin\/io\/heterogeneousmicroservices\/quarkusservice\/servicediscovery\/ConsulRegistrationBean.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@ApplicationScoped class ConsulRegistrationBean(     @Inject private val consulClient: ConsulClient ) {      fun onStart(@Observes event: StartupEvent) {         consulClient.register()     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0439 <code>ClientRequestFilter<\/code> \u0438 \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 <code>@Provider<\/code>:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 12. \u0424\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Service Discovery (<a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/src\/main\/kotlin\/io\/heterogeneousmicroservices\/quarkusservice\/servicediscovery\/ConsulFilter.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Provider @ApplicationScoped class ConsulFilter(     @Inject private val consulClient: ConsulClient ) : ClientRequestFilter {      override fun filter(requestContext: ClientRequestContext) {         val serviceName = requestContext.uri.host         val serviceInstance = consulClient.getServiceInstance(serviceName)         val newUri: URI = URIBuilder(URI.create(requestContext.uri.toString()))             .setHost(serviceInstance.address)             .setPort(serviceInstance.port)             .build()          requestContext.uri = newUri     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0444\u0438\u043b\u044c\u0442\u0440\u0435 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u043d\u0430 URI \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>requestContext<\/code> \u043d\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043a Consul.<\/p>\n<p>  <\/p>\n<h2 id=\"testirovanie\">\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0422\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 API \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 REST Assured:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 13. \u0422\u0435\u0441\u0442\u044b (<a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/src\/test\/kotlin\/io\/heterogeneousmicroservices\/quarkusservice\/QuarkusServiceApplicationTest.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@QuarkusTest class QuarkusServiceApplicationTest {      @Test     fun testGet() {         given()             .`when`().get(&quot;\/application-info&quot;)             .then()             .statusCode(200)             .contentType(ContentType.JSON)             .body(&quot;name&quot;) { `is`(&quot;quarkus-service&quot;) }             .body(&quot;framework.name&quot;) { `is`(&quot;Quarkus&quot;) }             .body(&quot;framework.releaseYear&quot;) { `is`(2019) }     }      @Test     fun testGetLogo() {         given()             .`when`().get(&quot;\/application-info\/logo&quot;)             .then()             .statusCode(200)             .contentType(&quot;image\/png&quot;)             .body(`is`(notNullValue()))     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 Consul, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0440\u044f\u0434\u043e\u043c \u0441 \u0442\u0435\u0441\u0442\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <code>ConsulClientMock<\/code>, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0439 <code>ConsulClient<\/code>:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 14. \u041c\u043e\u043a \u0434\u043b\u044f <code>ConsulClient<\/code> (<a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/quarkus-service\/src\/test\/kotlin\/io\/heterogeneousmicroservices\/quarkusservice\/ConsulClientMock.kt\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">@Mock @ApplicationScoped class ConsulClientMock : ConsulClient(&quot;&quot;, 0) {      \/\/ do nothing     override fun register() {     } }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"sborka\">\u0421\u0431\u043e\u0440\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u044f Gradle \u0437\u0430\u0434\u0430\u0447\u0438 <code>build<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 <code>quarkusBuild<\/code>. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 <em>runner<\/em> JAR \u0438 \u043f\u0430\u043f\u043a\u0443 <code>lib<\/code>, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f uber-JAR \u0437\u0430\u0434\u0430\u0447\u0430 <code>quarkusBuild<\/code> \u0434\u043e\u043b\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 15. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 uber-JAR (<a href=\"https:\/\/github.com\/rkudryashov\/heterogeneous-microservices\/blob\/master\/build.gradle.kts\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>)<\/p>\n<p>  <\/p>\n<pre><code class=\"kotlin\">tasks {     withType&lt;QuarkusBuild&gt; {         isUberJar = true     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>.\/gradlew clean build<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"zapusk\">\u0417\u0430\u043f\u0443\u0441\u043a<\/h2>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430\u0434\u043e \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u0442\u044c Consul (\u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 <a href=\"https:\/\/romankudryashov.com\/blog\/2020\/01\/heterogeneous-microservices\/#_launch\" rel=\"nofollow\">\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>).<\/p>\n<p>  <\/p>\n<p>\u041c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>Gradle \u0437\u0430\u0434\u0430\u0447\u0443 <code>quarkusDev<\/code><br \/>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<br \/>  <code>.\/gradlew :quarkus-service:quarkusDev<\/code><br \/>  \u0438\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 IDE<\/li>\n<li>uber-JAR<br \/>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<br \/>  <code>java -jar quarkus-service\/build\/quarkus-service-1.0.0-runner.jar<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c REST API, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<p>  <\/p>\n<p><code>GET http:\/\/localhost:8084\/application-info<\/code><\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442:<\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 16. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 API<\/p>\n<p>  <\/p>\n<pre><code class=\"json\">{   &quot;name&quot;: &quot;quarkus-service&quot;,   &quot;framework&quot;: {     &quot;name&quot;: &quot;Quarkus&quot;,     &quot;releaseYear&quot;: 2019   },   &quot;requestedService&quot;: null }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"sovmestimost-s-spring\">\u0421\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0441 Spring<\/h2>\n<p>  <\/p>\n<p>\u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c\u0438 Spring: <a href=\"https:\/\/quarkus.io\/guides\/spring-di\" rel=\"nofollow\">DI<\/a>, <a href=\"https:\/\/quarkus.io\/guides\/spring-web\" rel=\"nofollow\">Web<\/a>, <a href=\"https:\/\/quarkus.io\/guides\/spring-security\" rel=\"nofollow\">Security<\/a>, <a href=\"https:\/\/quarkus.io\/guides\/spring-data-jpa\" rel=\"nofollow\">Data JPA<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u044b\u043b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e REST \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 Quarkus \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Kotlin \u0438 Gradle. \u0412 <a href=\"https:\/\/romankudryashov.com\/blog\/2020\/01\/heterogeneous-microservices\/#_comparison_of_applications_parameters\" rel=\"nofollow\">\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 JVM \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0443 Quarkus \u0435\u0441\u0442\u044c \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a Helidon MicroProfile, Micronaut \u0438 Spring Boot (\u0435\u0441\u043b\u0438 \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e fullstack \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445). \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0434\u0443\u043c\u0430\u044e, \u043d\u0430\u0441 \u0436\u0434\u0451\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b Java.<\/p>\n<p>  <\/p>\n<h2 id=\"poleznye-ssylki\">\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/quarkus.io\/get-started\/\" rel=\"nofollow\">Quarkus \u2014 Get Started<\/a><\/li>\n<li><a href=\"https:\/\/quarkus.io\/blog\/quarkus-for-spring-developers\/\" rel=\"nofollow\">Quarkus for Spring Developers<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p>P.S. \u0421\u043f\u0430\u0441\u0438\u0431\u043e <a href=\"https:\/\/habr.com\/en\/users\/vladimirsitnikov\/\" class=\"user_link\">vladimirsitnikov<\/a> \u0437\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0432 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<\/div>\n<p> \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\/post\/484320\/\"> https:\/\/habr.com\/ru\/post\/484320\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/484320\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/b0\/c8\/k8\/b0c8k8k4cxgj8-czvjdrgn6uxgk.jpeg\"><\/p>\n<p>  <\/p>\n<h2 id=\"vvedenie\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0412 <a href=\"https:\/\/romankudryashov.com\/blog\/2020\/01\/heterogeneous-microservices\/\" rel=\"nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 JVM \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0445 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0448\u0435\u0434\u0448\u0438\u0439 <a href=\"https:\/\/quarkus.io\/\" rel=\"nofollow\">Quarkus<\/a> \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u0447\u0430\u0441\u0442\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f09\/7fd\/476\/f097fd47661517c348a85a4d3251ecb4.png\" alt=\"target architecture\"><\/p>\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-297283","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297283","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=297283"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297283\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}