{"id":551,"date":"2023-03-13T00:10:41","date_gmt":"2023-03-12T15:10:41","guid":{"rendered":"https:\/\/hirabay.net\/?p=551"},"modified":"2023-03-13T00:10:46","modified_gmt":"2023-03-12T15:10:46","slug":"%e3%80%90spring-cloud%e3%80%91bootstrap%e6%a9%9f%e8%83%bd%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/hirabay.net\/?p=551","title":{"rendered":"\u3010Spring Cloud\u3011bootstrap\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u307f\u305f"},"content":{"rendered":"\n<p>Spring Cloud\u306bbootstrap\u306a\u308b\u6a5f\u80fd\u304c\u3042\u308b\u3053\u3068\u306b\u6c17\u3065\u3044\u305f\u306e\u3067\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\uff01<\/p>\n\n\n\n<div class=\"toc\"><br \/>\n<b>Warning<\/b>:  Undefined array key \"is_admin\" in <b>\/home\/c4179872\/public_html\/hirabay.net\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>110<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_category_top\" in <b>\/home\/c4179872\/public_html\/hirabay.net\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>115<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_top\" in <b>\/home\/c4179872\/public_html\/hirabay.net\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>122<\/b><br \/>\n    <div id=\"toc_container\" class=\"sgb-toc--bullets js-smooth-scroll\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">\n  <li class=\"first\">\n    <a href=\"#i-0\">\u30e2\u30c1\u30d9\u30fc\u30b7\u30e7\u30f3<\/a>\n  <\/li>\n  <li>\n    <a href=\"#i-1\">bootstrap\u6a5f\u80fd\u3068\u306f\uff1f<\/a>\n  <\/li>\n  <li>\n    <a href=\"#i-2\">bootstrap\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u307f\u308b<\/a>\n    <ul class=\"menu_level_1\">\n      <li class=\"first\">\n        <a href=\"#i-3\">\u4f9d\u5b58\u3092\u8ffd\u52a0<\/a>\n      <\/li>\n      <li>\n        <a href=\"#i-4\">Configuration\u30af\u30e9\u30b9\u3092\u5b9f\u88c5<\/a>\n      <\/li>\n      <li class=\"last\">\n        <a href=\"#i-5\">\u52d5\u4f5c\u78ba\u8a8d<\/a>\n      <\/li>\n    <\/ul>\n  <\/li>\n  <li class=\"last\">\n    <a href=\"#i-6\">bootstrap\u7528\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u7528\u610f\u3059\u308b<\/a>\n  <\/li>\n<\/ul>\n\n      \n    <\/div><\/div><h2 class=\"wp-block-heading\" id=\"i-0\">\u30e2\u30c1\u30d9\u30fc\u30b7\u30e7\u30f3<\/h2>\n\n\n\n<p>\u3082\u3068\u3082\u3068spring-cloud-config\u3084spring-cloud-vault\u3068\u3044\u3063\u305f\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u5916\u90e8\u304b\u3089\u8aad\u307f\u8fbc\u3080\u4ed5\u7d44\u307f\u304c\u3042\u308b\u3053\u3068\u306f\u77e5\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001spring-cloud\u304c\u63d0\u4f9b\u3059\u308b\u30bd\u30fc\u30b9\u4ee5\u5916\u306e\u4efb\u610f\u306e\u5916\u90e8\u30ea\u30bd\u30fc\u30b9\u304b\u3089\u60c5\u5831\u304c\u53d6\u308c\u305f\u3089\u3044\u3044\u306a\u3068\u601d\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u305d\u3053\u3067spring-cloud-config\u306e\u4ed5\u7d44\u307f\u3092\uff08\u8aad\u307f\u89e3\u3051\u306a\u3044\u306a\u308a\u306b\uff09\u8aad\u307f\u89e3\u304f\u3068bootstrap\u3068\u3044\u3046\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u3044\u305d\u3046\u3060\u3063\u305f\u306e\u3067\u3001bootstrap\u3092\u30d9\u30fc\u30b9\u306b\u5b9f\u88c5\u3059\u308c\u3070\u5b9f\u73fe\u3067\u304d\u308b\u306e\u3067\u306f\u306a\u3044\u304b\uff1f\u3068\u601d\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-1\">bootstrap\u6a5f\u80fd\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>\u5b9f\u88c5\u3092\u3057\u306a\u304c\u3089\u3053\u3046\u3067\u306f\u306a\u3044\u304b\uff1f\u3068\u601d\u3063\u305f\u5185\u5bb9\u306a\u306e\u3067\u6b63\u78ba\u6027\u306b\u306f\u6b20\u3051\u307e\u3059\u304c\u3001\u3001\u3001<\/p>\n\n\n\n<p>Spring Boot\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8d77\u52d5\u524d\u306b\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u69cb\u6210\u60c5\u5831\u3092\u8aad\u307f\u8fbc\u307f\u3001\u69cb\u6210\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u306e\u3067\u304d\u308b\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u901a\u5e38\u306eSpring Boot\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u300cproperty\u8aad\u307f\u8fbc\u307f\u300d\u2192\u300cBean\u767b\u9332\u300d\u3068\u3044\u3046\u3088\u3046\u306a\u9806\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u8d77\u52d5\u3057\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u300cproperty\u8aad\u307f\u8fbc\u307f\u300d\u306e\u524d\u306e\u52d5\u4f5c\u3092\u5909\u3048\u3089\u308c\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-2\">bootstrap\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u307f\u308b<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-3\">\u4f9d\u5b58\u3092\u8ffd\u52a0<\/h3>\n\n\n\n<p>bootstrap\u6a5f\u80fd\u3092\u4f7f\u3046\u306b\u306f<code>spring-cloud-starter<\/code>\u3092\u4f9d\u5b58\u306b\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-groovy\" data-file=\"build.gradle\" data-lang=\"Groovy\"><code>ext {\n  set('springCloudVersion', \"2022.0.1\")\n}\n\ndependencies {\n  ...\n  implementation 'org.springframework.cloud:spring-cloud-starter'\n  ...\n}\n\ndependencyManagement {\n  imports {\n    mavenBom \"org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}\"\n  }\n}<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-4\">Configuration\u30af\u30e9\u30b9\u3092\u5b9f\u88c5<\/h3>\n\n\n\n<p>\u5b9f\u88c5\u65b9\u6cd5\u306f\u901a\u5e38\u306eSpringBoot\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u540c\u3058\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u3053\u3067\u306f\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066\u3001system\u30d7\u30ed\u30d1\u30c6\u30a3\u306b<code>sample.password=12345678<\/code>\u3092\u767b\u9332\u3059\u308b\u3088\u3046\u306a\u5b9f\u88c5\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-java\" data-lang=\"Java\"><code>package hirabay.bootstrap;\n\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.context.annotation.Configuration;\n\n@Slf4j\n@Configuration\npublic class SystemPropertyBootstrapAutoConfiguration {\n    public SystemPropertyBootstrapAutoConfiguration() {\n        System.setProperty(\"sample.password\", \"12345678\");\n        log.info(\"set sample.password\");\n    }\n}<\/code><\/pre><\/div>\n\n\n<p><\/p><div class=\"memo \"><div class=\"memo_ttl dfont\"> \u30e1\u30e2<\/div>\u304a\u305d\u3089\u304f\u3053\u306e\u5b9f\u88c5\u306fspring-cloud\u306e\u5229\u7528\u65b9\u6cd5\u3068\u3057\u3066\u30d9\u30b9\u30c8\u306a\u65b9\u6cd5\u3067\u306f\u306a\u3044\u3067\u3059\u3002<br>\n\uff08spring-cloud-config\u3068\u304b\u3082\u3063\u3068\u8907\u96d1\u306a\u4ed5\u7d44\u307f\u3067config\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u304b\u3089\u306d\u3002\u3002\u3002\uff09<br>\n\u305f\u3060\u3001\u8ab0\u3067\u3082\u3042\u308b\u7a0b\u5ea6\u52d5\u4f5c\u3092\u8ffd\u3048\u308b\u3068\u3044\u3046\u610f\u5473\u3067\u3053\u306e\u8a18\u4e8b\u3067\u306f\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u5185\u3067\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8a2d\u5b9a\u3059\u308b\u5b9f\u88c5\u4f8b\u3092\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u3002<\/div>\n\n\n\n<p>\u901a\u5e38\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u9055\u3046\u306e\u306f\u3001\u3053\u306eConfiguration\u30af\u30e9\u30b9\u3092\u300cspring.factories\u300d\u30d5\u30a1\u30a4\u30eb\u306b\u8a2d\u5b9a\u3092\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u70b9\u3067\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-properties\" data-file=\"META-INF\/spring.factories\" data-lang=\".properties\"><code>org.springframework.cloud.bootstrap.BootstrapConfiguration=\\\nhirabay.bootstrap.SystemPropertyBootstrapAutoConfiguration<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-5\">\u52d5\u4f5c\u78ba\u8a8d<\/h3>\n\n\n\n<p>\u3053\u306e\u72b6\u614b\u3067SpringBoot\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u8d77\u52d5\u3059\u308b\u3068\u3001\u3001\u3001<\/p>\n\n\n\n<p>\u30d0\u30ca\u30fc\u3088\u308a\u3082\u5148\u306b\u5148\u307b\u3069\u4ed5\u8fbc\u3093\u3060\u30ed\u30b0\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\uff01<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-plain\"><code>2023-03-12T23:55:20.887+09:00  INFO 67112 --- [           main] SystemPropertyBootstrapAutoConfiguration : set sample.password\n\n  .   ____          _            __ _ _\n \/\\\\ \/ ___'_ __ _ _(_)_ __  __ _ \\ \\ \\ \\\n( ( )\\___ | '_ | '_| | '_ \\\/ _` | \\ \\ \\ \\\n \\\\\/  ___)| |_)| | | | | || (_| |  ) ) ) )\n  '  |____| .__|_| |_|_| |_\\__, | \/ \/ \/ \/\n =========|_|==============|___\/=\/_\/_\/_\/\n :: Spring Boot ::                (v3.0.2)\n<\/code><\/pre><\/div>\n\n\n\n<p>\u3064\u307e\u308a\u3001application.yaml\u3084\u74b0\u5883\u5909\u6570\u3092\u8a2d\u5b9a\u305b\u305a\u3068\u3082\u4ee5\u4e0b\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8a2d\u5b9a\u3057\u305f\u306e\u3068\u540c\u3058\u72b6\u614b\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8d77\u52d5\u304c\u3067\u304d\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\uff01<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-yaml\" data-file=\"application.yaml\" data-lang=\"Yaml\"><code>sample:\n  password: 12345678<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-6\">bootstrap\u7528\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u7528\u610f\u3059\u308b<\/h2>\n\n\n\n<p>bootstrap\u6a5f\u80fd\u3067\u306f\u901a\u5e38application.yaml\u3084application.properties\u3067\u5b9a\u7fa9\u3059\u308b\u30d7\u30ed\u30d1\u30c6\u30a3\u3092<code>bootstrap.yaml<\/code>\u3084<code>bootstrap.properties<\/code>\u306b\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4f8b\u3048\u3070\u3001\u3053\u3093\u306aConfigurationProperties\u30af\u30e9\u30b9\u306b\u60c5\u5831\u3092\u8a70\u3081\u305f\u3044\u5834\u5408\u306f\u3001<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-plain\"><code>@Data\n@ConfigurationProperties(\"boostrap.sample\")\npublic class SampleProperties {\n    private String key;\n}<\/code><\/pre><\/div>\n\n\n\n<p><code>bootstrap.yaml<\/code>\u306e\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\uff08\u8a18\u8ff0\u65b9\u6cd5\u306f\u4e00\u7dd2\u3002\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u9055\u3046\u3060\u3051\u3002\uff09<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-yaml\" data-file=\"bootstrap.yaml\" data-lang=\"Yaml\"><code>boostrap:\n  sample:\n    key: value<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring Cloud\u306bbootstrap\u306a\u308b\u6a5f\u80fd\u304c\u3042\u308b\u3053\u3068\u306b\u6c17\u3065\u3044\u305f\u306e\u3067\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\uff01 Warning: Undefined array key &#8220;is_admin&#8221; in \/home\/c4179872\/publi &#8230; <\/p>\n","protected":false},"author":1,"featured_media":572,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[93,94,13],"class_list":{"0":"post-551","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-6","8":"tag-spring-cloud","9":"tag-spring-cloud-bootstrap","10":"tag-springboot"},"jetpack_featured_media_url":"https:\/\/hirabay.net\/wp-content\/uploads\/2023\/03\/RestTemplate-2.png","_links":{"self":[{"href":"https:\/\/hirabay.net\/index.php?rest_route=\/wp\/v2\/posts\/551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hirabay.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hirabay.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hirabay.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hirabay.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=551"}],"version-history":[{"count":3,"href":"https:\/\/hirabay.net\/index.php?rest_route=\/wp\/v2\/posts\/551\/revisions"}],"predecessor-version":[{"id":573,"href":"https:\/\/hirabay.net\/index.php?rest_route=\/wp\/v2\/posts\/551\/revisions\/573"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hirabay.net\/index.php?rest_route=\/wp\/v2\/media\/572"}],"wp:attachment":[{"href":"https:\/\/hirabay.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hirabay.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hirabay.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}