【发布时间】:2016-02-22 13:24:38
【问题描述】:
我扩展了AbstractByteArraySerializer,现在我想像其他可用的 TCP 序列化器(LF、NULL、L1、...)一样使用这个序列化器。
我在tcp-encdec.xml 中找到了个人资料并注册了自己的个人资料:
...
<beans profile="use-custom">
<bean id="CUSTOM"
class="custom.tcp.serializer.ByteArrayCustomSerializer">
<property name="maxMessageSize" value="${bufferSize}" />
</bean>
</beans>
...
Spring 使用 EncoderDecoderMixins.Encoding 将 Encoding 转换为特定配置文件。
EncoderDecoderMixins.Encoding 是最终类中的枚举。 Spring 将decoder TCP 属性转换为基于此枚举的特定配置文件。我的 CUSTOM 序列化程序无法工作,因为它不在指定的 Encodings 中。
有没有办法注册一个新的Encoding 或者我必须编写一个新的源模块才能使用我的序列化器?
【问题讨论】: