{"id":338001,"date":"2022-09-06T15:00:56","date_gmt":"2022-09-06T15:00:56","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=338001"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=338001","title":{"rendered":"<span>Spring Boot @ConfigurationProperties \u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><strong>\u0414\u0430\u043d\u043e:<\/strong><\/p>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 <strong>spring boot(2.6.4)<\/strong> + <strong>kotlin(1.5.31)<\/strong> \u043f\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0442\u0447\u0451\u0442\u043e\u0432 \u043f\u043e \u043a\u0440\u043e\u043d\u0443. \u041a\u0430\u0436\u0434\u044b\u0439 \u043e\u0442\u0447\u0435\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.  \u0414\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043e\u0442\u0447\u0451\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043f\u0438\u0441\u043e\u043a.  \u0414\u043b\u044f \u0438\u043d\u0436\u0435\u043a\u0442\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f data class \u0441 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 @ConfigurationProperties, \u0433\u0434\u0435 \u043e\u0434\u043d\u043e \u0438\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 &#8212; \u0441\u043f\u0438\u0441\u043e\u043a data class. <\/p>\n<p><strong>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/strong><\/p>\n<pre><code class=\"yaml\">#application.yml report-export:   cron: 0 0 12 * *   reports:     - file-prefix: REPORT1       region-name: \u041c\u043e\u0441\u043a\u0432\u0430       sftp-host: host1       sftp-port: 22       sftp-user: user1       sftp-password: pwd1     - file-prefix: REPORT2       region-name: \u041f\u043e\u0434\u043e\u043b\u044c\u0441\u043a       sftp-host: host1       sftp-port: 22       sftp-user: user1       sftp-password: pwd2<\/code><\/pre>\n<pre><code class=\"kotlin\">@ConfigurationProperties(\"report-export\") @ConstructorBinding data class ReportExportProperties(     val cron: String,     val reports: List&lt;ReportProperties> ) {      data class ReportProperties(         val filePrefix: String,         val regionName: String,         val sftpHost: String,         val sftpPort: Int,         val sftpUser: String     ) }<\/code><\/pre>\n<p>\u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043b\u0443\u0447\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 property source. \u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0441\u0435\u043a\u0440\u0435\u0442 sftp-password \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d \u0432 Vault.<\/p>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e <a href=\"https:\/\/docs.spring.io\/spring-boot\/docs\/current\/reference\/htmlsingle\/#features.external-config.typesafe-configuration-properties.merging-complex-types\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <\/a>\u0441\u043f\u0438\u0441\u043a\u0438 \u0434\u043b\u044f @<em>ConfigurationProperties<\/em> \u043c\u0451\u0440\u0434\u0436\u0443\u0442\u0441\u044f \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 Vault \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0440\u0435\u0442\u044b <em>sftp-password<\/em>, \u0442\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 data class \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0431\u0443\u0434\u0443\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0437\u0430\u0434\u0430\u043d\u044b ( \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u044b &#8212; \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043d\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0435\u0442\u0441\u044f). <strong>\u0422.\u0435. \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0435 \u043c\u0451\u0440\u0434\u0436\u0438\u0442\u0441\u044f, \u0430 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437 property source \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043e\u043c \u043a\u0430\u043a \u0435\u0441\u0442\u044c.<\/strong><\/p>\n<p>\u041d\u0438\u0436\u0435 \u0442\u0435\u0441\u0442, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439, \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043c\u0451\u0440\u0434\u0436 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0430 \u0434\u043b\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 &#8212; \u043d\u0435\u0442:<\/p>\n<pre><code class=\"yaml\">#application.yml tpp:   test:     root:       root-field1: default       nested:         nested-field1: default       nested-list:         - nested-list-field1: default1         - nested-list-field1: default2 #application-dev.yml tpp:   test:     root:       root-field2: dev       nested:         nested-field2: dev       nested-list:         - nested-list-field2: dev1         - nested-list-field2: dev2<\/code><\/pre>\n<pre><code class=\"kotlin\">@ConfigurationProperties(\"tpp.test.root\") @ConstructorBinding data class RootPropperties(     val rootField1: String = \"\",     val rootField2: String = \"\",     val nested: NestedProperties = NestedProperties(),     val nestedList: List&lt;NestedListProperties> = listOf() ) {      data class NestedProperties(         val nestedField1: String = \"\",         val nestedField2: String = \"\"     )      data class NestedListProperties(         val nestedListField1: String = \"\",         val nestedListField2: String = \"\"     ) }<\/code><\/pre>\n<pre><code class=\"kotlin\">@ActiveProfiles(\"dev\") @SpringBootTest internal class ConfigurationPropertiesTest {      @Autowired     lateinit var rootPropperties: RootPropperties      @Test     fun `configuration properties binding`() {         assertEquals(\"default\", rootPropperties.rootField1)         assertEquals(\"dev\", rootPropperties.rootField2)          assertEquals(\"dev\", rootPropperties.nested.nestedField2)         assertEquals(\"default\", rootPropperties.nested.nestedField1)          assertTrue(rootPropperties.nestedList.isNotEmpty())         assertEquals(\"dev1\", rootPropperties.nestedList[0].nestedListField2)         assertEquals(\"dev2\", rootPropperties.nestedList[1].nestedListField2)         \/\/ \u0417\u0434\u0435\u0441\u044c \u043f\u0430\u0434\u0430\u0435\u0442         \/\/ org.opentest4j.AssertionFailedError:         \/\/Expected :default1         \/\/Actual   :         assertEquals(\"default1\", rootPropperties.nestedList[0].nestedListField1)         \/\/ \u0417\u0434\u0435\u0441\u044c \u043f\u0430\u0434\u0430\u0435\u0442         \/\/ org.opentest4j.AssertionFailedError:         \/\/Expected :default2         \/\/Actual   :         assertEquals(\"default2\", rootPropperties.nestedList[1].nestedListField1)     } } <\/code><\/pre>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442, \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044f \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 <a href=\"https:\/\/docs.spring.io\/spring-framework\/docs\/current\/javadoc-api\/org\/springframework\/core\/env\/Environment.html\" rel=\"noopener noreferrer nofollow\">Environment<\/a>, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440:<\/p>\n<pre><code class=\"kotlin\">@ActiveProfiles(\"dev\") @SpringBootTest internal class ConfigurationPropertiesTest {      @Autowired     lateinit var environment: Environment      @Test     fun `environment binding`() {         assertEquals(\"default\", environment.getProperty(\"tpp.test.root.root-field1\"))         assertEquals(\"dev\", environment.getProperty(\"tpp.test.root.root-field2\"))          assertEquals(\"default\", environment.getProperty(\"tpp.test.root.nested.nested-field1\"))         assertEquals(\"dev\", environment.getProperty(\"tpp.test.root.nested.nested-field2\"))          assertEquals(\"default1\", environment.getProperty(\"tpp.test.root.nested-list[0].nested-list-field1\"))         assertEquals(\"dev1\", environment.getProperty(\"tpp.test.root.nested-list[0].nested-list-field2\"))          assertEquals(\"default2\", environment.getProperty(\"tpp.test.root.nested-list[1].nested-list-field1\"))         assertEquals(\"dev2\", environment.getProperty(\"tpp.test.root.nested-list[1].nested-list-field2\"))     } }<\/code><\/pre>\n<p>\u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432 \u043c\u043e\u0435\u043c <a href=\"https:\/\/github.com\/spring-projects\/spring-boot\/issues\/32165#issuecomment-1227717648\" rel=\"noopener noreferrer nofollow\">issue <\/a>\u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0438 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 workaround &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Map \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0442\u0435\u0441\u0442:<\/p>\n<pre><code class=\"yaml\">#application.yml tpp:   test:     root-map:       root-field1: default       nested:         nested-field1: default       nested-map:         1:           nested-map-field1: default1         2:           nested-map-field1: default2  #application-dev.yml tpp:   test:     root-map:       root-field2: dev       nested:         nested-field2: dev       nested-map:         1:           nested-map-field2: dev1         2:           nested-map-field2: dev2 <\/code><\/pre>\n<pre><code class=\"kotlin\">@ActiveProfiles(\"dev\") @SpringBootTest internal class ConfigurationPropertiesMapTest {      @Autowired     lateinit var environment: Environment      @Autowired     lateinit var rootPropperties: RootMapPropperties      @Test     fun `configuration properties binding`() {         Assertions.assertEquals(\"default\", rootPropperties.rootField1)         Assertions.assertEquals(\"dev\", rootPropperties.rootField2)          Assertions.assertEquals(\"default\", rootPropperties.nested.nestedField1)         Assertions.assertEquals(\"dev\", rootPropperties.nested.nestedField2)          Assertions.assertTrue(rootPropperties.nestedMap.isNotEmpty())         Assertions.assertEquals(\"default1\", rootPropperties.nestedMap[\"1\"]!!.nestedMapField1)         Assertions.assertEquals(\"dev1\", rootPropperties.nestedMap[\"1\"]!!.nestedMapField2)         Assertions.assertEquals(\"default2\", rootPropperties.nestedMap[\"2\"]!!.nestedMapField1)         Assertions.assertEquals(\"dev2\", rootPropperties.nestedMap[\"2\"]!!.nestedMapField2)     } }<\/code><\/pre>\n<p>\u0423 \u043c\u0435\u043d\u044f \u043d\u0435\u0442 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0433\u043e \u043c\u043d\u0435\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b spring, \u0447\u0442\u043e \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u0451\u0440\u0434\u0436\u0430 \u0434\u043b\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u0430\u044f \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043e\u0434\u043d\u043e\u043c property source 2 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0432 \u0434\u0440\u0443\u0433\u043e\u043c 3. \u041a\u0430\u043a \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043c\u0451\u0440\u0434\u0436\u0438\u0442\u044c \u043b\u0438 \u044d\u0442\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440? \u041c\u043e\u0435 \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043c\u0451\u0440\u0434\u0436\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a Map \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432. \u0422.\u0435. \u043f\u0435\u0440\u0432\u044b\u0435 2 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0451\u0440\u0434\u0436\u0443\u0442\u0441\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430\u043c property source, \u0430 3\u0439 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0435\u0441\u0442\u044c, \u0442.\u043a. \u043e\u043d \u0437\u0430\u0434\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u043c property source. \u041a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435 Environment \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u0438\u0445 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0441\u0442\u0435\u0439. \u0410 \u043a\u0430\u043a \u0434\u0443\u043c\u0430\u0435\u0442\u0435 \u0412\u044b?<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0431\u043d\u044b\u0439 \u043f\u043e\u0441\u0442. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043e\u043d \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u044b\u043c.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/post\/686726\/\"> https:\/\/habr.com\/ru\/post\/686726\/<\/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><strong>\u0414\u0430\u043d\u043e:<\/strong><\/p>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 <strong>spring boot(2.6.4)<\/strong> + <strong>kotlin(1.5.31)<\/strong> \u043f\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0442\u0447\u0451\u0442\u043e\u0432 \u043f\u043e \u043a\u0440\u043e\u043d\u0443. \u041a\u0430\u0436\u0434\u044b\u0439 \u043e\u0442\u0447\u0435\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.  \u0414\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043e\u0442\u0447\u0451\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043f\u0438\u0441\u043e\u043a.  \u0414\u043b\u044f \u0438\u043d\u0436\u0435\u043a\u0442\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f data class \u0441 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 @ConfigurationProperties, \u0433\u0434\u0435 \u043e\u0434\u043d\u043e \u0438\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 &#8212; \u0441\u043f\u0438\u0441\u043e\u043a data class. <\/p>\n<p><strong>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/strong><\/p>\n<pre><code class=\"yaml\">#application.yml report-export:   cron: 0 0 12 * *   reports:     - file-prefix: REPORT1       region-name: \u041c\u043e\u0441\u043a\u0432\u0430       sftp-host: host1       sftp-port: 22       sftp-user: user1       sftp-password: pwd1     - file-prefix: REPORT2       region-name: \u041f\u043e\u0434\u043e\u043b\u044c\u0441\u043a       sftp-host: host1       sftp-port: 22       sftp-user: user1       sftp-password: pwd2<\/code><\/pre>\n<pre><code class=\"kotlin\">@ConfigurationProperties(\"report-export\") @ConstructorBinding data class ReportExportProperties(     val cron: String,     val reports: List&lt;ReportProperties> ) {      data class ReportProperties(         val filePrefix: String,         val regionName: String,         val sftpHost: String,         val sftpPort: Int,         val sftpUser: String     ) }<\/code><\/pre>\n<p>\u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043b\u0443\u0447\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 property source. \u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0441\u0435\u043a\u0440\u0435\u0442 sftp-password \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d \u0432 Vault.<\/p>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e <a href=\"https:\/\/docs.spring.io\/spring-boot\/docs\/current\/reference\/htmlsingle\/#features.external-config.typesafe-configuration-properties.merging-complex-types\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <\/a>\u0441\u043f\u0438\u0441\u043a\u0438 \u0434\u043b\u044f @<em>ConfigurationProperties<\/em> \u043c\u0451\u0440\u0434\u0436\u0443\u0442\u0441\u044f \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 Vault \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0440\u0435\u0442\u044b <em>sftp-password<\/em>, \u0442\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 data class \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0431\u0443\u0434\u0443\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0437\u0430\u0434\u0430\u043d\u044b ( \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u044b &#8212; \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043d\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0435\u0442\u0441\u044f). <strong>\u0422.\u0435. \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0435 \u043c\u0451\u0440\u0434\u0436\u0438\u0442\u0441\u044f, \u0430 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437 property source \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043e\u043c \u043a\u0430\u043a \u0435\u0441\u0442\u044c.<\/strong><\/p>\n<p>\u041d\u0438\u0436\u0435 \u0442\u0435\u0441\u0442, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439, \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043c\u0451\u0440\u0434\u0436 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0430 \u0434\u043b\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 &#8212; \u043d\u0435\u0442:<\/p>\n<pre><code class=\"yaml\">#application.yml tpp:   test:     root:       root-field1: default       nested:         nested-field1: default       nested-list:         - nested-list-field1: default1         - nested-list-field1: default2 #application-dev.yml tpp:   test:     root:       root-field2: dev       nested:         nested-field2: dev       nested-list:         - nested-list-field2: dev1         - nested-list-field2: dev2<\/code><\/pre>\n<pre><code class=\"kotlin\">@ConfigurationProperties(\"tpp.test.root\") @ConstructorBinding data class RootPropperties(     val rootField1: String = \"\",     val rootField2: String = \"\",     val nested: NestedProperties = NestedProperties(),     val nestedList: List&lt;NestedListProperties> = listOf() ) {      data class NestedProperties(         val nestedField1: String = \"\",         val nestedField2: String = \"\"     )      data class NestedListProperties(         val nestedListField1: String = \"\",         val nestedListField2: String = \"\"     ) }<\/code><\/pre>\n<pre><code class=\"kotlin\">@ActiveProfiles(\"dev\") @SpringBootTest internal class ConfigurationPropertiesTest {      @Autowired     lateinit var rootPropperties: RootPropperties      @Test     fun `configuration properties binding`() {         assertEquals(\"default\", rootPropperties.rootField1)         assertEquals(\"dev\", rootPropperties.rootField2)          assertEquals(\"dev\", rootPropperties.nested.nestedField2)         assertEquals(\"default\", rootPropperties.nested.nestedField1)          assertTrue(rootPropperties.nestedList.isNotEmpty())         assertEquals(\"dev1\", rootPropperties.nestedList[0].nestedListField2)         assertEquals(\"dev2\", rootPropperties.nestedList[1].nestedListField2)         \/\/ \u0417\u0434\u0435\u0441\u044c \u043f\u0430\u0434\u0430\u0435\u0442         \/\/ org.opentest4j.AssertionFailedError:         \/\/Expected :default1         \/\/Actual   :         assertEquals(\"default1\", rootPropperties.nestedList[0].nestedListField1)         \/\/ \u0417\u0434\u0435\u0441\u044c \u043f\u0430\u0434\u0430\u0435\u0442         \/\/ org.opentest4j.AssertionFailedError:         \/\/Expected :default2         \/\/Actual   :         assertEquals(\"default2\", rootPropperties.nestedList[1].nestedListField1)     } } <\/code><\/pre>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442, \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044f \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 <a href=\"https:\/\/docs.spring.io\/spring-framework\/docs\/current\/javadoc-api\/org\/springframework\/core\/env\/Environment.html\" rel=\"noopener noreferrer nofollow\">Environment<\/a>, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440:<\/p>\n<pre><code class=\"kotlin\">@ActiveProfiles(\"dev\") @SpringBootTest internal class ConfigurationPropertiesTest {      @Autowired     lateinit var environment: Environment      @Test     fun `environment binding`() {         assertEquals(\"default\", environment.getProperty(\"tpp.test.root.root-field1\"))         assertEquals(\"dev\", environment.getProperty(\"tpp.test.root.root-field2\"))          assertEquals(\"default\", environment.getProperty(\"tpp.test.root.nested.nested-field1\"))         assertEquals(\"dev\", environment.getProperty(\"tpp.test.root.nested.nested-field2\"))          assertEquals(\"default1\", environment.getProperty(\"tpp.test.root.nested-list[0].nested-list-field1\"))         assertEquals(\"dev1\", environment.getProperty(\"tpp.test.root.nested-list[0].nested-list-field2\"))          assertEquals(\"default2\", environment.getProperty(\"tpp.test.root.nested-list[1].nested-list-field1\"))         assertEquals(\"dev2\", environment.getProperty(\"tpp.test.root.nested-list[1].nested-list-field2\"))     } }<\/code><\/pre>\n<p>\u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432 \u043c\u043e\u0435\u043c <a href=\"https:\/\/github.com\/spring-projects\/spring-boot\/issues\/32165#issuecomment-1227717648\" rel=\"noopener noreferrer nofollow\">issue <\/a>\u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0438 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 workaround &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Map \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0442\u0435\u0441\u0442:<\/p>\n<pre><code class=\"yaml\">#application.yml tpp:   test:     root-map:       root-field1: default       nested:         nested-field1: default       nested-map:         1:           nested-map-field1: default1         2:           nested-map-field1: default2  #application-dev.yml tpp:   test:     root-map:       root-field2: dev       nested:         nested-field2: dev       nested-map:         1:           nested-map-field2: dev1         2:           nested-map-field2: dev2 <\/code><\/pre>\n<pre><code class=\"kotlin\">@ActiveProfiles(\"dev\") @SpringBootTest internal class ConfigurationPropertiesMapTest {      @Autowired     lateinit var environment: Environment      @Autowired     lateinit var rootPropperties: RootMapPropperties      @Test     fun `configuration properties binding`() {         Assertions.assertEquals(\"default\", rootPropperties.rootField1)         Assertions.assertEquals(\"dev\", rootPropperties.rootField2)          Assertions.assertEquals(\"default\", rootPropperties.nested.nestedField1)         Assertions.assertEquals(\"dev\", rootPropperties.nested.nestedField2)          Assertions.assertTrue(rootPropperties.nestedMap.isNotEmpty())         Assertions.assertEquals(\"default1\", rootPropperties.nestedMap[\"1\"]!!.nestedMapField1)         Assertions.assertEquals(\"dev1\", rootPropperties.nestedMap[\"1\"]!!.nestedMapField2)         Assertions.assertEquals(\"default2\", rootPropperties.nestedMap[\"2\"]!!.nestedMapField1)         Assertions.assertEquals(\"dev2\", rootPropperties.nestedMap[\"2\"]!!.nestedMapField2)     } }<\/code><\/pre>\n<p>\u0423 \u043c\u0435\u043d\u044f \u043d\u0435\u0442 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0433\u043e \u043c\u043d\u0435\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b spring, \u0447\u0442\u043e \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u0451\u0440\u0434\u0436\u0430 \u0434\u043b\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u0430\u044f \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043e\u0434\u043d\u043e\u043c property source 2 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0432 \u0434\u0440\u0443\u0433\u043e\u043c 3. \u041a\u0430\u043a \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043c\u0451\u0440\u0434\u0436\u0438\u0442\u044c \u043b\u0438 \u044d\u0442\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440? \u041c\u043e\u0435 \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043c\u0451\u0440\u0434\u0436\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a Map \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432. \u0422.\u0435. \u043f\u0435\u0440\u0432\u044b\u0435 2 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0451\u0440\u0434\u0436\u0443\u0442\u0441\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430\u043c property source, \u0430 3\u0439 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0435\u0441\u0442\u044c, \u0442.\u043a. \u043e\u043d \u0437\u0430\u0434\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u043c property source. \u041a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435 Environment \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u0438\u0445 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0441\u0442\u0435\u0439. \u0410 \u043a\u0430\u043a \u0434\u0443\u043c\u0430\u0435\u0442\u0435 \u0412\u044b?<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0431\u043d\u044b\u0439 \u043f\u043e\u0441\u0442. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043e\u043d \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u044b\u043c.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/post\/686726\/\"> https:\/\/habr.com\/ru\/post\/686726\/<\/a><br \/><\/br><\/br><\/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-338001","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338001","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=338001"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338001\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}