I am creating a system using cloud-dataflow, I have a source and a transformer. We like to use kryo, but some of our classes require custom kryo serializers, I have written serializers before. We are now using spring-integration-core-4.3.11, and since 4.2 the model has changes(per the docs) to use Codecs instead of MessageConverter interface.
The question is, how can I register the kryo serializers in the new Codec framework, do I make a new Codec implementation inheriting from MessageCodec? Do I create a new Registrar implementation?
Just making the implementation a bean would it be discovered? I found Codec being Autowired, but nowhere found them being produced....
thanks in advance!
See KryoCodecAutoConfiguration .
You can either replace the standard PojoCodec
with your own bean, or simply add your registrar (and any others needed) and SCSt will wire them into the default PojoCodec
....
@Bean
@ConditionalOnMissingBean(PojoCodec.class)
public PojoCodec codec() {
Map<String, KryoRegistrar> kryoRegistrarMap = applicationContext.getBeansOfType(KryoRegistrar.class);
return new PojoCodec(new ArrayList<>(kryoRegistrarMap.values()), kryoCodecProperties.isReferences());
}
@Bean
@ConditionalOnMissingBean(KryoRegistrar.class)
public KryoRegistrar fileRegistrar() {
return new FileKryoRegistrar();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.