@Bean
CamelContextConfiguration contextConfiguration() {
return new CamelContextConfiguration() {
@Override
public void beforeApplicationStart(CamelContext context) {
// Enable Jackson JSON type converter.
context.getGlobalOptions().put(JacksonConstants.ENABLE_TYPE_CONVERTER, "true");
// Allow Jackson JSON to convert to pojo types also
// (by default Jackson only converts to String and other simple types)
getContext().getGlobalOptions().put(JacksonConstants.TYPE_CONVERTER_TO_POJO, "true");
}
@Override
public void afterApplicationStart(CamelContext camelContext) {
}
};
}
@Bean
CamelContextConfiguration contextConfiguration() {
return new CamelContextConfiguration() {
@Override
public void beforeApplicationStart(CamelContext context) {
// Enable Jackson JSON type converter.
context.getGlobalOptions().put(JacksonConstants.ENABLE_TYPE_CONVERTER, "true");
// Allow Jackson JSON to convert to pojo types also
// (by default Jackson only converts to String and other simple types)
getContext().getGlobalOptions().put(JacksonConstants.TYPE_CONVERTER_TO_POJO, "true");
}
@Override
public void afterApplicationStart(CamelContext camelContext) {
}
};
}
Copy to ClipboardCopied!Toggle word wrapToggle overflow
camel-jackson 类型转换器与 JAXB 集成,这意味着您可以使用 Jackson 的 JAXB 注解为 POJO 类添加注解。您还可以在 POJO 类中使用 Jackson 自己的注解。