可我有多个bindy注解在包中的类,仍然解组CSV的骆驼? [英] Can I have multiple bindy annotated classes in a package and still unmarshal CSVs in Camel?

查看:177
本文介绍了可我有多个bindy注解在包中的类,仍然解组CSV的骆驼?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有一个包状my.company.bindy几个类中的所有与Bindy注解。然后,我想有骆驼的路线,可以解组CSV到这些类型之一。我知道了所有的工作,但如果我有一个以上的bindy在包注释类解组失败。这是因为Bindy试图到CSV行解组包中的每一个类。和一个特定的线将无法正常编组入的类的多于一个。我DATAFORMAT声明在Spring这样的:

 < bean类=org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat>
    <属性名=套餐VALUE =my.company.bindy/>
< /豆>


解决方案

此问题已得到修复与骆驼2.16.0。

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

如果你使用多个模型,每个模型都有被放置在它自己的包prevent未predictable结果。

从骆驼2.16起这不再的情况下,你可以放心地有多个车型在同一个包,当你使用类名,而不是包名现在配置bindy。

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>

解决方案

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."

这篇关于可我有多个bindy注解在包中的类,仍然解组CSV的骆驼?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆