Spring Boot 4.1系とkeel 3.0.0へ追随 - #48
Open
kumagoro1202 wants to merge 1 commit into
Open
Conversation
サンプルアプリケーションの親を spring-boot-starter-parent:3.2.0 から 4.1.0 へ更新し、 あわせて keel を 2.0.0 から 3.0.0 へ更新する。 Spring Boot 4系での主な追随内容: - 自動設定のモジュール分割にあわせた依存の追加 (spring-boot-starter-flyway / spring-boot-starter-restclient / spring-boot-starter-webmvc-test / spring-boot-starter-jdbc / spring-boot-starter-jackson) - Testcontainers のモジュール名変更への追随 - Jackson 3 への移行にあわせたテストの import 変更 - Content-Disposition の符号化仕様変更にあわせた期待値の修正 - セキュリティ自動設定の FQCN 変更にあわせた除外指定の更新 - MockMvc への springSecurity() の明示適用 - TestRestTemplate への @AutoConfigureTestRestTemplate の付与 - Spring Batch 6 での循環参照を避けるための JobRepository 受け取り方の変更 - logbook が必要とする json-path 3.0.0 への引き上げ ドキュメントについても、参照先の外部ドキュメントのバージョンを更新する。 Spring Boot 4系はリファレンスのURL体系が変わっているため、参照パスもあわせて修正する。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
このPRは keel v3.0.0 が Maven Central へ公開された後にマージしてください。
それ以前にマージすると、公開ドキュメントが存在しない版を参照することになります。
公開後、マージ前に「Maven Central からの解決確認」(後述)を実施してください。
概要
サンプルアプリケーション群を Spring Boot 4.1.0 系へ更新し、あわせて keel を v3.0.0 へ追随させます。
サンプルの親は
spring-boot-starter-parent:3.2.0(2023-12-22 が最終更新)で停止していたため、Spring Boot 4 系までの変更をまとめて取り込んでいます。
主な変更
ライブラリのバージョン更新(
samples/pom.xml)testcontainers-bomの import は削除しました(Spring Boot 4 系が管理するようになったため)。Spring Boot 4 系のモジュール分割への追随
Spring Boot 4 系では自動設定が機能単位のモジュールへ分割されたため、各サンプルの依存を修正しています。
spring-boot-starter-flyway経由で宣言RestTemplateBuilder→spring-boot-starter-restclientを追加spring-boot-starter-testからspring-boot-starter-webmvc-testへjunit-jupiter→testcontainers-junit-jupiterほか)依存解決の不整合への対処
logbook4.1.0 は Jackson 3 を利用するためjson-path3.0.0 以上を必要としますが、Spring Boot 4.1.0 が管理する
json-pathは 2.10.0 で、Jackson 3 向けのJsonProviderを含みません。そのままでは実行時に
NoClassDefFoundError(Jackson3JsonNodeJsonProvider)となるため、samples/pom.xmlでjson-path.versionを 3.0.0 に引き上げています。仕様変更に伴うテスト・設定の修正
Content-Dispositionの符号化: Spring Framework 7 系では、filenameはRFC 2047 形式(
=?UTF-8?Q?...?=)ではなく ASCII のみのフォールバックとなり、実際のファイル名は RFC 5987 形式の
filename*で表現されるよう変更されました。期待値を修正し、不要になった
commons-codecへの依存も削除しています。org.springframework.boot.autoconfigure.security.*からorg.springframework.boot.security.autoconfigure.*へ移動したため、spring.autoconfigure.excludeの指定を更新しました。@AutoConfigureMockMvcがSpring Security の MockMvc 連携を自動適用しなくなったため、
springSecurity()を明示的に適用するよう修正しました(これがないと
@WithMockUserが反映されず 401 になります)。tools.jackson)を使用するため、テストでの
ObjectMapperの import を変更しました。なお注釈(jackson-annotations)は2 系のままのため、
com.fasterxml.jackson.annotation.*は変更していません。spring-boot-starter-batchの依存変更: 4 系ではspring-boot-starter-jdbcを推移的に含まなくなったため、バッチの 2 モジュールへ明示的に追加しました。
JobRepositoryを供給する自動設定自身がJobBean を収集するようになったため、
@ConfigurationのコンストラクタでJobRepositoryを受け取ると循環参照になります。
@Beanメソッドの引数で受け取る形へ変更しました。S3Template:S3ObjectConverterが Jackson のクラスパス存在を条件に構成されるため、
spring-boot-starter-jacksonを追加しました。database-rider と JUnit 6 について(既知の制約)
Spring Boot 4.1 は JUnit 6 を採用しますが、database-rider は最新の 1.44.0 でも
JUnit 5 前提でビルドされており、同一 JVM で複数のテストクラスを続けて実行すると、
クラス内で最初に実行されるテストメソッドへ
@DataSetが適用されないことがあります。暫定対応として
api-error-handlingの surefire をreuseForks=falseにしています。database-rider が JUnit 6 に対応した時点で、この設定は削除できます。
@DBRiderを使用する他の 3 モジュールは現状のテスト内容では問題が表面化していませんが、同じ制約下にあります。
ドキュメント(
doc/conf.py)の参照バージョン更新サンプルのスタック更新にあわせて、外部ドキュメントへのリンク先バージョンを更新しました。
Spring Boot 4 系はリファレンスの URL 体系が変わっている(
/spring-boot/<version>/配下へ移動し、/spring-boot/docs/<version>/reference/html/は提供されない)ため、.rst側の参照パスもあわせて修正しています。
確認したこと
samples配下のビルド(テスト含む)が成功することdocのliteralincludeが指す区間マーカーが実ファイルに存在し、埋め込み対象がずれていないことマージ前に必要な確認(keel v3.0.0 の公開後)
keel v3.0.0 は本 PR 作成時点で Maven Central に未公開です。検証は、
keel を手元で
mvn installしたローカルリポジトリ上で行っています。そのため公開後、空のローカルリポジトリで Central からのみ解決できることを確認してから
マージしてください。
(
samplesディレクトリで実行。keel を含む全依存が Maven Central から解決され、ビルドが成功することを確認する)