[?xml version="1.0" encoding="UTF-8"?]
[!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"]
[beans]
[!--我们在外部使用的话,要不直接把id为"remoteService"的bean注入,通过它调用方法来促成远程调用,或者使用aop方式,就像id为"courseInfoService"的bean那样--要是用Burlap的话,改为BurlapProxyFactoryBean就行了,so simple--]
[bean id="remoteService"
class="org.springframework.remoting.caucho.HessianProxyFactoryBean"]
[property name="serviceUrl"]
[value]http://xxx.xxx.xxx.xxx:8080/remote/remoteService[/value]
[/property]
[property name="serviceInterface"]
[value]
org.wsw.framework.remoteservice.MyService
[/value]
[/property]
[/bean]
[bean name="remoteUserRegMethodAdvice"
class="org.wsw.framework.remoteservice.RemoteUserAdvice"]
[property name="remoteService"]
[ref bean="remoteService" /]
[/property]
[property name="netUpdateService"]
[ref bean="netUpdateService" /]
[/property]
[/bean]
[!--class:CourseInfoServiceSpringImpl_method:NetCourseInfoVO doCourseInfoRemoteCreate(NetCourseInfoVO netCourseInfoVO)--]
[bean id="courseInfoService"
class="org.springframework.aop.framework.ProxyFactoryBean"][!-- aop代理类 --]
[property name="target"]
[ref local="courseInfoTarget" /][!-- 通过courseInfoService调用目标类的方法,并用remoteRegisterCall拦截器对方法进行拦截 --]
[/property]
[property name="interceptorNames"]
[list]
[value]remoteRegisterCall[/value]
[/list]
[/property]
[/bean]
[!-- 该bean只针对上面的那个bean --]
[bean id="remoteRegisterCall"
class="org.springframework.aop.support.RegexpMethodPointcutAdvisor"]
[property name="advice"]
[ref bean="remoteUserRegMethodAdvice" /][!-- 该类声明了采用何种切入方式(切入方式有before,after等等),以及相关处理 --]
[/property]
[property name="pattern"]
[value].*Remote*.*[/value]
[/property]
[/bean]
[/beans]