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 Hessian 2.0. By default, HSF uses the serialization method based on Hessian 2.0. The following table describes the differences between and configurations of the two serialization methods. Configure HSFApiProviderBean objects only for service providers.

Serialization methodMaven dependencyConfigurationCompatibilityPerformance
Hessian 2.0<artifactId>hsf-io-serialize-hessian2</artifactId>setPreferSerializeType("hessian2")ExcellentExcellent


Use APIs to configure HSF services

HSFApiProviderBean hsfApiProviderBean = new HSFApiProviderBean();

Use Spring to configure HSF services

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

<bean class="" init-method="init">
    <!--[Specify] the API for service publishing. -->
    <property name="serviceInterface" value=""/>
    <!--[Specify] 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"/>
    <!--[Specify] the version of the service. -->
    <property name="serviceVersion" value="1.0.0"/>
    <!--[Specify] the group to which the service belongs. -->
    <property name="serviceGroup" value="HSF"/>
    <!--[Set] the service response time. -->
    <property name="clientTimeout" value="3000"/>
    <!--[Specify] the serialization type for transmitting the object in service implementation. -->
    <property name="preferSerializeType" value="hessian2"/>