Spring batch : FlatFileItemWriter header never called

后端 未结 1 515
无人及你
无人及你 2021-01-28 12:47

I have a weird issue with my FlatFileItemWriter callbacks. I have a custom ItemWriter implementing both FlatFileFooterCallback and FlatFileHeaderCallback. Consequently, I set he

相关标签:
1条回答
  • 2021-01-28 13:18

    When using Java config as you are, it's best to return the most specific type possible (the opposite of what you're normally told to do in java programming). In this case, your writer is returning ItemWriter, but is step scoped. Because of this a proxy is created that can only see the type that your java config returns which in this case is ItemWriter and does not expose the methods on the ItemStream interface. If you return CityItemWriter, I'd expect things to work.

    0 讨论(0)
提交回复
热议问题