{"id":6604,"date":"2022-10-18T22:29:35","date_gmt":"2022-10-18T13:29:35","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=6604"},"modified":"2022-10-18T15:43:35","modified_gmt":"2022-10-18T06:43:35","slug":"spring-cloud-vault-%ec%97%b0%eb%8f%99%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=6604","title":{"rendered":"Spring Cloud Vault \uc5f0\ub3d9\ud558\uae30"},"content":{"rendered":"<h1>Spring Cloud Vault \uc5f0\ub3d9\ud558\uae30<\/h1>\n<h2>Spring Boot \ubc84\uc804 \uccb4\ud06c<\/h2>\n<p>\uc544\ub798 \ub0b4\uc6a9\uc740 \ubc84\uc804 2.7.4 \uc5d0\uc11c \ud14c\uc2a4\ud2b8\ub418\uc5c8\uc2b5\ub2c8\ub2e4.<\/p>\n<p>2.4, 2.5 \ubc84\uc804\uc911\uc5d0 \ubcc0\ub3d9\uc0ac\ud56d\uc774 \ud06c\uae30\ub54c\ubb38\uc5d0 \ubc84\uc804\uc744 \uccb4\ud06c\ud574\uc57c \ud569\ub2c8\ub2e4.<\/p>\n<h2>\uc758\uc874\uc131 \ucd94\uac00<\/h2>\n<pre><code class=\"language-gradle\">dependencies {\n    implementation &#039;org.springframework.boot:spring-boot-starter-web&#039;\n    implementation &#039;org.springframework.boot:spring-boot-configuration-processor&#039;\n    implementation &#039;org.springframework.cloud:spring-cloud-starter-vault-config:3.1.1&#039;\n    compileOnly &#039;org.projectlombok:lombok&#039;\n    annotationProcessor &#039;org.projectlombok:lombok&#039;\n    testImplementation &#039;org.springframework.boot:spring-boot-starter-test&#039;\n}<\/code><\/pre>\n<h2>application.yml<\/h2>\n<p>\ubc18\ub4dc\uc2dc application.yml \uc5d0 \ub0b4\uc6a9\uc744 \ucd94\uac00\ud574\uc57c \ud558\uace0,<br \/>\nprofile \uc124\uc815 \ubc0f \ud65c\uc131\ud654\uac00 \ub418\uc5b4\uc57c \ud569\ub2c8\ub2e4.<\/p>\n<blockquote>\n<p>application-dev.yml \uac19\uc740 \ud30c\uc77c\uba85\uc744 \uc0ac\uc6a9\ud558\uba74 \uc548\ub429\ub2c8\ub2e4.<\/p>\n<\/blockquote>\n<pre><code class=\"language-yaml\"># \uc911\uc694!!! \ud65c\uc131\ud654\ub41c \ud504\ub85c\ud30c\uc77c\uc744 \uc9c0\uc815\ud574 \uc8fc\uc5b4\uc57c \ud55c\ub2e4.\nspring:\n  config:\n    activate:\n      on-profile: &quot;dev&quot;\n    import: vault:\/\/team1\/foo\nspring.cloud.vault:\n  fail-fast: true\n  authentication: APPROLE\n  app-role:\n    role-id: 2067e81e-be8e-49ef-3XXXXXXXXXX\n    secret-id: c8d69559-77fe-359e-XXXXXXXXXXXXXX\n  uri: http:\/\/43.201.XXX.XXX:8200\n  connection-timeout: 5000\n  read-timeout: 15000\n---\nspring:\n  config:\n    activate:\n      on-profile: &quot;prod&quot;\n    import: vault:\/\/team1\/foo\nspring.cloud.vault:\n  fail-fast: true\n  authentication: APPROLE\n  app-role:\n    role-id: 2067e81e-be8e-49ef-3XXXXXXXXXX\n    secret-id: c8d69559-77fe-359e-XXXXXXXXXXXXXX\n  uri: http:\/\/43.201.XXX.XXX:8200\n  connection-timeout: 5000\n  read-timeout: 15000<\/code><\/pre>\n<h2>\ub370\uc774\ud0c0 \uac00\uc838\uc624\uae30<\/h2>\n<p>\ubaa8\ub4e0 \uc124\uc815\uc774 \uc774\ub8e8\uc5b4\uc9c0\uba74 \uc544\ub798\ucc98\ub7fc \ud658\uacbd\ubcc0\uc218\uc5d0\uc11c \uac12\uc744 \uac00\uc838\uc624\ub294 \uac83\uacfc \ub3d9\uc77c\ud55c \ubc29\uc2dd\uc73c\ub85c,<br \/>\nvault \uc5d0\uc11c \ube44\ubc00\ubc88\ud638\ub97c \uac00\uc838\uc62c \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p>\ud658\uacbd\ubcc0\uc218\uba85\uc5d0 \uc911\ubcf5\uc774 \uc788\ub294 \uacbd\uc6b0,<br \/>\n\ub2e4\ub978 \ud658\uacbd\ubcc0\uc218\uac12\uc744 \uac00\uc838\uc62c \uc218 \uc788\ub2e4.<\/p>\n<pre><code class=\"language-java\">@RestController\n@SpringBootApplication\n@RequiredArgsConstructor\npublic class VaultTestApplication {\n\n    private final Environment env;\n\n    @RequestMapping(&quot;\/&quot;)\n    public String home() {\n        System.out.println(env.getProperty(&quot;password&quot;));\n\n        return &quot;OK!&quot;;\n    }\n\n    public static void main(String[] args) {\n        SpringApplication.run(VaultTestApplication.class, args);\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Spring Cloud Vault \uc5f0\ub3d9\ud558\uae30 Spring Boot \ubc84\uc804 \uccb4\ud06c \uc544\ub798 \ub0b4\uc6a9\uc740 \ubc84\uc804 2.7.4 \uc5d0\uc11c \ud14c\uc2a4\ud2b8\ub418\uc5c8\uc2b5\ub2c8\ub2e4. 2.4, 2.5 \ubc84\uc804\uc911\uc5d0 \ubcc0\ub3d9\uc0ac\ud56d\uc774 \ud06c\uae30\ub54c\ubb38\uc5d0 \ubc84\uc804\uc744 \uccb4\ud06c\ud574\uc57c \ud569\ub2c8\ub2e4. \uc758\uc874\uc131 \ucd94\uac00 dependencies { implementation &#039;org.springframework.boot:spring-boot-starter-web&#039; implementation &#039;org.springframework.boot:spring-boot-configuration-processor&#039; implementation &#039;org.springframework.cloud:spring-cloud-starter-vault-config:3.1.1&#039; compileOnly &#039;org.projectlombok:lombok&#039; annotationProcessor &#039;org.projectlombok:lombok&#039; testImplementation &#039;org.springframework.boot:spring-boot-starter-test&#039; } application.yml \ubc18\ub4dc\uc2dc application.yml \uc5d0 \ub0b4\uc6a9\uc744 \ucd94\uac00\ud574\uc57c \ud558\uace0, profile \uc124\uc815 \ubc0f \ud65c\uc131\ud654\uac00 \ub418\uc5b4\uc57c \ud569\ub2c8\ub2e4. application-dev.yml \uac19\uc740 \ud30c\uc77c\uba85\uc744\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=6604\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-6604","post","type-post","status-publish","format-standard","hentry","category-nomad"],"_links":{"self":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6604"}],"version-history":[{"count":4,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6604\/revisions"}],"predecessor-version":[{"id":6608,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6604\/revisions\/6608"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}