Java のバッチ処理を Spring Batch フレームワークを使って作成しようと思って、サイトの情報をググりながら作業してたんだけど、Spring Batch の「chunk(チャンク)」モデルのバッチを作成しようとしていきなり問題が(^^;;;
org.springframework.batch.item 以下のクラスが import できないのである。
Maven のローカルキャッシュ(.m2)の下の repository\org\springframework\batch を見てみると、
spring-batch-bomspring-batch-corespring-batch-infrastructurespring-batch-test
しかないやん。今回、Spring Batch は最新バージョンの 6.0.3 を使っているので、クラスの構成変わったんかな?
ググってみたけど、org.springframework.batch.item というのがある前提の記事ばっかで・・・
結局、item は org.springframework.batch.infrastructure の下にあった。
エラーが出ている行で「インポートの構成」を選択。
「インポートする型の選択」で「org.springframework.batch.infrastructure.item.ParseException」を選択。
(「org.springframework.batch.item.ItemReade」のエラー行を指定しているので「org.springframework.batch.infrastructure.item.ItemReader」が表示されそうなもんだが、よくわからん。こういうもの?)
これで、
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 を使った記事を書いてほしいです。

コメントする