0

I use Apache Camel in a Spring Boot Java project. I have to parse a csv and split the lines with a separator. I use camel bindy to parse the csv and read it as a pojo bean class.

Here is how I configure the camel bindy

@CsvRecord( separator = "," )
public Class MyClass {
}

Here is my question: how can I change the separator value dynamically, reading it from a property? I've tried @CsvRecord( separator = "${my-prop.separator}" ) but it did not work.

geocodezip
  • 158,664
  • 13
  • 220
  • 245
Fjordo
  • 768
  • 3
  • 18
  • 40

1 Answers1

0

Not that I know of. If you have a known set of delimiters, you could have a separate DTO class (w/ @CsvRecord annotation) for each one, i.e. MyClassComma, MyClassSemicolon, etc. Then at runtime choose the correct DTO class based on a spring property that specifies the delimiter.

Jeremy Ross
  • 11,544
  • 3
  • 36
  • 36