spring提供了与hessian的集成,这样就会大大减少代码的嵌入和编写,让我们让关注与自身的业务,spring的org.springframework.remoting.caucho.HessianServiceExporter类提供了hessian的代理,下面开始hessian于spring的简单集成。
1、准备spring和hessian的相关依赖包
spring的依赖包
hessian依赖包 hessian-4.0.7.jar(可以自行去hessian官网下载)
2、编写服务接口api和实现
api类
api实现
3、编写hessian与spring集成的xml
通过org.springframework.remoting.caucho.HessianServiceExporter代理hessian,我命名为hessian-remote-servlet.xml(注意命名和web.xml中servlet配置有关系,否则找不到xml配置文件)
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>