The serialization process converts a Java object into a byte array that can be transmitted over a network. The deserialization process converts a byte array into a Java object.


When you select a serialization method, you must consider factors including compatibility and performance. High-Speed Service Framework (HSF) supports serialization in Java and serialization based on hessian2. By default, HSF uses the serialization method based on hessian2. The following table describes the differences and configurations of the two serialization methods. Configure HSFApiProviderBean only for service providers.

Serialization method Maven dependency Configuration Compatibility Performance
hessian2 <artifactId>hsf-io-serialize-hessian2</artifactId> setPreferSerializeType("hessian2") Excellent High
java <artifactId>hsf-io-serialize-java</artifactId> setPreferSerializeType("java") Excellent Moderate


Configure HSF services by using API

HSFApiProviderBean hsfApiProviderBean = new HSFApiProviderBean();

Configure HSF services by using the Spring Framework

The Spring Framework is a component that is widely used in applications. If you do not want to configure HSF services by using API, you can configure them by using Spring XML. The following XML configuration has the same effect as the API configuration in the preceding example.

<bean class="" init-method="init">
    <! --Set the interface for service publishing. -->
    <property name="serviceInterface" value=""/>
    <! --Set the target of the object in service implementation to [ref], which indicates the Spring bean ID of the HSF service to be published.-->
    <property name="target" ref="Referenced bean ID"/>
    <! --Set the version of the service. -->
    <property name="serviceVersion" value="1.0.0"/>
    <! --Set the group to which the service belongs. -->
    <property name="serviceGroup" value="HSF"/>
    <! --Set the service response time. -->
    <property name="clientTimeout" value="3000"/>
    <! --Set the serialization type for transmitting the object in service implementation. -->
    <property name="preferSerializeType" value="hessian2"/>