apache-camelbindy

Can I have multiple bindy annotated classes in a package and still unmarshal CSVs in Camel?


I would like to have a package like my.company.bindy with several classes in it all annotated with Bindy annotations. Then I'd like to have Camel routes that can unmarshal CSV into one of these types. I've got it all working, but unmarshalling fails if I have more than one bindy annotated class in the package. This because Bindy is trying to unmarshal the CSV line into every class in the package. And a particular line won't properly marshal into more than one of the classes. My dataformat is declared in Spring like this:

<bean class="org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat">
    <property name="packages" value="my.company.bindy"/>
</bean>

Solution

  • This issue has been fixed with Camel 2.16.0.

    From http://camel.apache.org/bindy.html

    "If you use multiple models, each model has to be placed in it's own package to prevent unpredictable results.

    From Camel 2.16 onwards this is no longer the case, as you can safely have multiple models in the same package, as you configure bindy using class names instead of package names now."