Spring Batch - how to convert String from file to Date?

后端 未结 1 1629
心在旅途
心在旅途 2020-12-19 16:23

I am trying to process a CSV file in which some of the fields are dates of the format \"yyyy-MM-dd\" - but the reader fails when it tries to convert the String

相关标签:
1条回答
  • 2020-12-19 17:07

    your forum reference is for type conversion while building the application context and configuring the beans

    take a look at the JavaDoc for the BeanWrapperFieldSetMapper

    To customize the way that FieldSet values are converted to the desired type for injecting into the prototype there are several choices. You can inject PropertyEditor instances directly through the customEditors *property*, or you can override the createBinder(Object) and initBinder(DataBinder) methods, or you can provide a custom FieldSet implementation.

    meaning you should inject your CustomDateEditor directly into the Mapper

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