**在ApacheIgnite中插入自定义序列化程序**

**在ApacheIgnite中插入自定义序列化程序**,ignite,Ignite,在Apache Ignite中插入自定义序列化程序 我试图在二进制配置bean中添加Kyro序列化程序,但在运行时它给了我一个类类型转换错误 我的代码是 <property name="binaryConfiguration"> <bean class="org.apache.ignite.configuration.BinaryConfiguration"> <property name="typeConf

在Apache Ignite中插入自定义序列化程序

我试图在二进制配置bean中添加Kyro序列化程序,但在运行时它给了我一个类类型转换错误

我的代码是

 <property name="binaryConfiguration">
            <bean class="org.apache.ignite.configuration.BinaryConfiguration">
                <property name="typeConfigurations">
                    <list>
                        <bean class="org.apache.ignite.binary.BinaryTypeConfiguration">
                            <property name="typeName" value="testPojo" />
                            <property name="serializer">
                                <bean class="com.esotericsoftware.kryo.serializers.DefaultSerializers" />
                            </property>
                        </bean>
                    </list>
                </property>
            </bean>
        </property>
在深入研究ApacheIgnite提供的BinarySerializer后,得出的结论是,必须像其他插件序列化程序一样为序列化程序编写自定义实现


优化的封送拆收器有什么好处?

BinarySerializer
是一个可以实现的接口,用于为特定类型自定义(反)序列化逻辑。这类似于
binarymaryler
Externalizable
,它是自Ignite 1.5以来的默认封送器。有关详细信息,请参阅本页:

OptimizedMarshaller
实现了旧式序列化协议,该协议在引入二进制格式之前就已使用。它仍然可用,但建议使用二进制格式


您还可以实现自己的封送器(例如,基于Kryo)。为此,实现
Marshaller
接口,并通过
IgniteConfiguration.setMarshaller()在配置中提供此实现
属性。

是否有必要使用像kryo这样的自定义序列化程序来获得空间和速度优化,还是二进制封送器本身就足够好?二进制封送器比kryo或本机Java序列化更紧凑、更高效
Caused by: java.lang.IllegalStateException: Cannot convert value of type [com.esotericsoftware.kryo.serializers.DefaultSerializers] to required type [org.apache.ignite.binary.BinarySerializer] for property 'serializer': no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:302)
    at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:576)
    ... 104 more