1. 首先加入hessain.jar包
<dependency><groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>
<version>4.0.7</version>
</dependency>
2. 如果是服务端需要配置web.xml
<servlet><servlet-name>hession</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:hession-web.xml
classpath*:hession-config.xml
</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping><servlet-name>hession</servlet-name>
<url-pattern>/hession/*</url-pattern>
</servlet-mapping>
3. 服务端hessain.-web.xml配置
<bean name="/openService" class="org.springframework.remoting.caucho.HessianServiceExporter">
<property name="service" ref="openServiceImpl" />
<property name="serviceInterface" value="com.open.service.OpenService" />
</bean>
4. 客户端调用openService
<bean id="openService" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
<property name="serviceUrl" value="http://localhost/hessain/openService" />
<property name="serviceInterface" value="com.open.service.openService" />
</bean>
客户端只要openService的interface