{"id":19792279,"url":"https://github.com/making/hajiboot-samples","last_synced_at":"2026-03-14T21:52:51.332Z","repository":{"id":22729248,"uuid":"26073953","full_name":"making/hajiboot-samples","owner":"making","description":"書籍「はじめてのSpring Boot」のサポートページ","archived":false,"fork":false,"pushed_at":"2018-04-24T06:39:41.000Z","size":324,"stargazers_count":132,"open_issues_count":21,"forks_count":66,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-06T07:43:06.019Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/making.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-02T06:54:38.000Z","updated_at":"2025-01-20T02:40:42.000Z","dependencies_parsed_at":"2022-08-21T11:31:08.892Z","dependency_job_id":null,"html_url":"https://github.com/making/hajiboot-samples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/making%2Fhajiboot-samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/making%2Fhajiboot-samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/making%2Fhajiboot-samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/making%2Fhajiboot-samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/making","download_url":"https://codeload.github.com/making/hajiboot-samples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251812227,"owners_count":21647866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T07:06:33.825Z","updated_at":"2026-03-14T21:52:46.298Z","avatar_url":"https://github.com/making.png","language":"Shell","readme":"⭐️\\ **Spring Boot2**\\ の本は\\ `オンライン \u003chttps://note.ik.am\u003e`_\\ で執筆中です。サンプルコードは\\ `こちら \u003chttps://github.com/making/hajiboot2-samples\u003e`_\\ です。⭐️\n\n\n----\n\n「はじめてのSpring Boot [改訂版]」サポートページ\n********************************************************************************\n\n「\\ `はじめてのSpring Boot [改訂版] \u003chttp://www.kohgakusha.co.jp/books/detail/978-4-7775-1969-9\u003e`_\\ 」のサポートページです。\n\n**「はじめてのSpring Boot」初版(表紙がピンク)対応のサンプルコードは**\\ `こちら \u003chttps://github.com/making/hajiboot-samples/tree/1st-edition\u003e`_\\ **です。**\n\nこのページでサンプルコードと正誤表を管理します。書籍の内容に関する間違いの指摘等はIssuesかPull Requestでお願いします。\n\nまた、疑問やコメントはTwitterでハッシュタグ「\\ `#hajiboot \u003chttps://twitter.com/hashtag/hajiboot?f=tweets\u0026vertical=default\u003e`_\\ 」をつけてツイートしていただければ極力お答えします。気軽にツイートしてください。\n\n**本の内容が最新Spring Bootでは動かないという場合もサポートいたします**\\ ので、\\ `Issueで報告 \u003chttps://github.com/making/hajiboot-samples/issues/new\u003e`_\\ お願いいたします。\n回答の保証はありませんが、Spring Bootに関するよろず質問でもOKです。\n\n正誤表 (第3刷)\n================================================================================\n\n.. list-table::\n   :header-rows: 1\n\n   * - 場所\n     - 誤\n     - 正\n     - 訂正日\n   * - P.135, 136 アルゴリズム名\n     - ``PBKPF2``\n     - ``PBKDF2``\n     - 2018-04-23\n\n正誤表 (第2刷)\n================================================================================\n\n.. list-table::\n   :header-rows: 1\n\n   * - 場所\n     - 誤\n     - 正\n     - 訂正日\n   * - P.107 ``goToTop``\\ メソッドの上のアノテーション\n     - ``@GetMapping(path = \"edit\", params = \"goToTop\")``\n     - ``@PostMapping(path = \"edit\", params = \"goToTop\")``\n     - 2017-09-19\n   * - P.111 ``goToTop``\\ メソッドの上のアノテーション\n     - ``@RequestMapping(path = \"edit\", params = \"goToTop\")``\n     - ``@PostMapping(path = \"edit\", params = \"goToTop\")``\n     - 2017-09-19\n   * - P.135, 136 アルゴリズム名\n     - ``PBKPF2``\n     - ``PBKDF2``\n     - 2018-04-23\n   * - P.164\n     - ``application-cloud.proerties``\n     - ``application-cloud.properties``\n     - 2017-09-18\n   * - P.176\n     - ``spring.datasource.url:jdbc:h2:mem:customers;DB_CLOSE_ON_EXIT=FALSE``\n     - ``spring.datasource.url:jdbc:log4jdbc:h2:mem:customers;DB_CLOSE_ON_EXIT=FALSE``\n     - 2017-09-18\n   * - P.179\n     - ``spring.datasource.url:jdbc:h2:mem:customers;DB_CLOSE_ON_EXIT=FALSE``\n     - ``spring.datasource.url:jdbc:log4jdbc:h2:mem:customers;DB_CLOSE_ON_EXIT=FALSE``\n     - 2017-09-18\n     \n正誤表 (第1刷)\n================================================================================\n\n.. list-table::\n   :header-rows: 1\n\n   * - 場所\n     - 誤\n     - 正\n     - 訂正日\n   * - P.31 (プログラム解説)\n     - (2),(3),(4) (1つずつずれている)\n     - (3),(4),(5)\n     - 2016-09-18\n   * - P.31 (プログラム解説)\n     - \\- (漏れている)\n     - \\(2\\) 「JavaConfig」を読み込むために、「@Import」で「@Configuration」アノテーション を付けた対象のクラスを指定。\n     - 2016-09-18\n   * - P.36 \n     - \\-\n     - ``Frontend``\\ クラスの上の\\ ``@Bean``\\ のインデントがずれている\n     - 2016-11-07\n   * - P.44\n     - Appクラス\n     - HajibootLayeringApplicationクラス\n     - 2016-09-18\n   * - P.61\n     - Appクラス\n     - HajibootJdbcApplicationクラス\n     - 2016-09-18\n   * - P.61\n     - https://console.run.pivotal.io/2/\n     - https://console.run.pivotal.io\n     - 2016-11-07\n   * - P.81 (プログラム解説)\n     - (5), (5)\n     - (5), (6)\n     - 2016-09-18\n   * - P.83 (6)\n     - NO_CONTENT\n     - NO CONTENT\n     - 2016-11-07\n   * - P.85\n     - 204NoContent\n     - 204 No Content\n     - 2016-11-07\n   * - P.86\n     - ``ResponseEntity\u003cCustomerpostCustomers(@RequestBody Customer customer, UriComponentsBuilder uriBuilder /* (1) */) {``\n     - ``ResponseEntity\u003cCustomer\u003e postCustomers(@RequestBody Customer customer, UriComponentsBuilder uriBuilder /* (1) */) {``\n     - 2016-11-07\n   * - P.94 (4)\n     - コンテスト・パス\n     - コンテキスト・パス\n     - 2016-11-07\n   * - P.107 ``editForm``\\ メソッドの上のアノテーション\n     - ``@PostMapping(path = \"edit\", params = \"form\")``\n     - ``@GetMapping(path = \"edit\", params = \"form\")``\n     - 2016-11-07\n   * - P.107 ``goToTop``\\ メソッドの上のアノテーション\n     - ``@GetMapping(path = \"edit\", params = \"goToTop\")``\n     - ``@PostMapping(path = \"edit\", params = \"goToTop\")``\n     - 2017-09-19\n   * - P.111 ``goToTop``\\ メソッドの上のアノテーション\n     - ``@RequestMapping(path = \"edit\", params = \"goToTop\")``\n     - ``@PostMapping(path = \"edit\", params = \"goToTop\")``\n     - 2017-09-19\n   * - P.124 (2か所)\n     - application.yml\n     - application.properties\n     - 2016-09-09\n   * - P.124\n     - ``security.basic.enabled: false``\n     - ``security.basic.enabled=false``\n     - 2016-09-09\n   * - P.129 下\n     - ``return new Pbkdf2PasswordEncoder(); // ()``\n     - ``return new Pbkdf2PasswordEncoder(); // (9)``\n     - 2016-11-07\n   * - P.130 下\n     - (10)の行\n     - 不要 (初版の残り)\n     - 2016-11-07\n   * - P.133 (1)\n     - 「loginForm?error=true」に遷移するように\n     - 「loginForm?error」に遷移するように\n     - 2016-11-07\n   * - P.134 下\n     - ``\u003cp\u003e\u003cspan sec:authentication=\"principal.user.username\"\u003eduke\u003c/span\u003eさんログイン中。\u003c/p\u003e``\n     - この3行削除 (P. 141で登場）\n     - 2016-11-07\n   * - P.135\n     - ``src/main/resources/migration/V3__add_user.sql`` (2箇所)\n     - ``src/main/resources/migration/V3__add-user.sql``\n     - 2016-11-07\n   * - P.135, 136 アルゴリズム名\n     - ``PBKPF2``\n     - ``PBKDF2``\n     - 2018-04-23\n   * - P.151\n     - 2つ目の (1)\n     - \\(2\\)\n     - 2016-11-07\n   * - P.152\n     - https://console.run.pivotal.io/2/\n     - https://console.run.pivotal.io\n     - 2016-11-07\n   * - P.164\n     - ``application-cloud.proerties``\n     - ``application-cloud.properties``\n     - 2017-09-18\n   * - P.171\n     - \\-\n     - [4.7]の前に「\\ `Spring Cloud Connectorsのコネクションプールに関する設定 \u003chttps://github.com/making/hajiboot-samples/blob/master/README.rst#spring-cloud-connectorsのコネクションプールに関する設定\u003e`_\\ 」を追加\n     - 2016-11-07\n   * - P.176\n     - ``spring.datasource.url:jdbc:h2:mem:customers;DB_CLOSE_ON_EXIT=FALSE``\n     - ``spring.datasource.url:jdbc:log4jdbc:h2:mem:customers;DB_CLOSE_ON_EXIT=FALSE``\n     - 2017-09-18\n   * - P.179\n     - ``spring.datasource.url:jdbc:h2:mem:customers;DB_CLOSE_ON_EXIT=FALSE``\n     - ``spring.datasource.url:jdbc:log4jdbc:h2:mem:customers;DB_CLOSE_ON_EXIT=FALSE``\n     - 2017-09-18\n\n補足\n================================================================================\n\n\"[4.6.4] 「Spring Boot Actuator」で「アプリケーションの状態」を監視\"のSpring Boot 1.5対応\n--------------------------------------------------------------------------------\n\nSpring Boot 1.5から、「Spring Boot Actuator」のエンドポイントに対して、自動で認可設定が行われるようになりました。\n[3.5]で説明したSpring Securityを使用し、認証ユーザーに対して\"ROLE_ACTUATOR\"ロールを付与する事で、\n認証後に「Spring Boot Actuator」のエンドポイントにアクセスできます。\n\nあるいは\\ ``application.properties``\\ に\n\n.. code-block:: properties\n\n   management.security.enabled=false\n\n\nを設定する事で、「Spring Boot Actuator」に対する認可制御を無効にできます。\n\n\nSpring Cloud Connectorsのコネクションプールに関する設定\n--------------------------------------------------------------------------------\n\n``AbstractCloudConfig``\\ のデフォルト設定ではコネクションプールに関する設定が固定されてしまいます。コネクションプールに関する設定を行う場合は、次のように\\ ``PooledServiceConnectorConfig.PoolConfig``\\ クラスを使用します。\n\n.. code-block:: java\n\n   package com.example;\n\n   import javax.sql.DataSource;\n\n   import org.springframework.cloud.config.java.AbstractCloudConfig;\n   import org.springframework.cloud.service.PooledServiceConnectorConfig;\n   import org.springframework.cloud.service.relational.DataSourceConfig;\n   import org.springframework.context.annotation.Bean;\n   import org.springframework.context.annotation.Configuration;\n   import org.springframework.context.annotation.Profile;\n\n   @Configuration\n   @Profile(\"cloud\")\n   public class CloudConfig extends AbstractCloudConfig {\n       @Bean\n       DataSource dataSource() {\n           PooledServiceConnectorConfig.PoolConfig poolConfig = new PooledServiceConnectorConfig.PoolConfig(\n                   5 /* 最小プール数 */, 30 /* 最大プール数 */, 3000 /* 最大待機時間 */);\n           return connectionFactory().dataSource(new DataSourceConfig(poolConfig, null));\n       }\n   }\n\n実は[4.6.3]で説明したAuto-Reconfigurationを利用すると次のログが出力されていました。\n\n.. code-block:: console\n\n   org.apache.tomcat.jdbc.pool.ConnectionPool         WARNING maxIdle is larger than maxActive, setting maxIdle to: 4``\n\nこれはAuto-Reconfiguration側で最大接続数を4に指定しているからです(バックエンドサービスの無償枠向け)。[14]\n\n基本的にはspring-cloud-connectorを使って、コネクションプールの設定をすべきです。\n\n[14] .. https://discuss.pivotal.io/hc/en-us/articles/221898227-Connection-pool-warning-message-maxIdle-is-larger-than-maxActive-setting-maxIdle-to-4-seen-in-PCF-deployed-Spring-app\n\n「[4.5.4] アプリケーションのログ」で言及されているログマネージャーとの連携方法\n--------------------------------------------------------------------------------\n\nhttps://github.com/Pivotal-Japan/cf-workshop/blob/master/logging.md\nに記載しました。\n\nPCF Devについて\n--------------------------------------------------------------------------------\n\\ `PCF Dev \u003chttp://pcfdev.io\u003e`_\\ は開発用にローカル環境で簡単にCloud Foundryを試すためのVM環境です。Pivotal Cloud Foundryが提供しているサービス(MySQL、Redis、RabbitMQ)も初めから組み込まれていて、Virtual Boxだけで簡単にローカル開発環境を用意できます。\n\n書面では名前だけ挙げて、使い方を紹介していないため、\nPCF Devの使い方は\\ `こちら \u003chttps://github.com/Pivotal-Japan/cf-workshop/blob/master/pcf-dev.md\u003e`_\\ を参照してください。\n\nFAQ\n================================================================================\n\nPCF Devで本のサンプルアプリをデプロイできない\n--------------------------------------------------------------------------------\n\nSpring Boot 1.4からはjarのレイアウトが変わり、Cloud Foundryで動かすには\\ `Java Buildpack 3.7以上が必要 \u003chttps://github.com/pivotal-cf/pcfdev/issues/130\u003e`_\\ になります。\\ `PCF Dev v.0.20.0 \u003chttps://network.pivotal.io/products/pcfdev#/releases/2298\u003e`_\\ 以上を使用してください。\n\n\nPCF Dev v0.19以下の場合の対応方法は\\ `こちら \u003chttp://bit.ly/pcfdev-boot14\u003e`_\\ を参照してください。\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaking%2Fhajiboot-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaking%2Fhajiboot-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaking%2Fhajiboot-samples/lists"}