Spring Batch 6 でクラス構成が変わった?

Java のバッチ処理を Spring Batch フレームワークを使って作成しようと思って、サイトの情報をググりながら作業してたんだけど、Spring Batch の「chunk(チャンク)」モデルのバッチを作成しようとしていきなり問題が(^^;;;
org.springframework.batch.item 以下のクラスが import できないのである。

Maven のローカルキャッシュ(.m2)の下の repository\org\springframework\batch を見てみると、

spring-batch-bom
spring-batch-core
spring-batch-infrastructure
spring-batch-test

しかないやん。今回、Spring Batch は最新バージョンの 6.0.3 を使っているので、クラスの構成変わったんかな?
ググってみたけど、org.springframework.batch.item というのがある前提の記事ばっかで・・・

結局、item は org.springframework.batch.infrastructure の下にあった。

エラーが出ている行で「インポートの構成」を選択。

20260508_spring1.jpg

「インポートする型の選択」で「org.springframework.batch.infrastructure.item.ParseException」を選択。
(「org.springframework.batch.item.ItemReade」のエラー行を指定しているので「org.springframework.batch.infrastructure.item.ItemReader」が表示されそうなもんだが、よくわからん。こういうもの?)

20260508_spring2.jpg

これで、

import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.NonTransientResourceException;
import org.springframework.batch.item.ParseException;
import org.springframework.batch.item.UnexpectedInputException;

が、

import org.springframework.batch.infrastructure.item.ItemReader;
import org.springframework.batch.infrastructure.item.NonTransientResourceException;
import org.springframework.batch.infrastructure.item.ParseException;
import org.springframework.batch.infrastructure.item.UnexpectedInputException;

に置き換わって幸せになった。

しかし、この先も最新版を使ってる故の苦労がありそうだ。

エロい人たち、早く Spring Batch 6 を使った記事を書いてほしいです。

トラックバック(0)

このブログ記事を参照しているブログ一覧: Spring Batch 6 でクラス構成が変わった?

このブログ記事に対するトラックバックURL: https://blog.netandfield.com/mt/mt-tb.cgi/7188

コメントする

このブログ記事について

このページは、shinodaが2026年5月 9日 10:43に書いたブログ記事です。

ひとつ前のブログ記事は「吉野家の鉄板焼肉定食」です。

次のブログ記事は「sendmail で Envelope From をセットしてメール送信」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。

月別 アーカイブ

電気ウナギ的○○ mobile ver.

携帯版「電気ウナギ的○○」はこちら