Spring Rmi

在项目中使用Spring RMI现在紧急做下代码级别的记录方便以后使用。

服务器配置项:

<!-- 抽象的session工厂-->
	<bean id="xxxSessionFactory" 		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
		<property name="dataSource" ref="dataSource"/>
		<property name="mappingResources">
		<list>	
		<value>com/xx/xxxx/business/entity/xxxxxxx.hbm.xml</value>	
		</list>
		</property>
		<property name="hibernateProperties">
		 <props>
                   <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                   <prop key="show_sql">false</prop>
                   <prop key="hibernate.query.substitutions">true 'y', false 'n', yes 'y', no 'n'</prop>
                 </props>
		</property>
	</bean>

 //Spring声明式事务

<bean id="xxxTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"
          lazy-init="false">
        <property name="sessionFactory">
            <ref bean="xxxSessionFactory"/>
        </property>
    </bean>
<bean id="basePsmProxyTemplate" abstract="true"
          class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" lazy-init="false">
        <property name="transactionManager">
            <ref bean="xxxTransactionManager"/>
        </property>
        <property name="transactionAttributes">
   	<!-- 下面定义事务传播属性 -->  
            <props>
                <prop key="save*">PROPAGATION_REQUIRED</prop>
                <prop key="remove*">PROPAGATION_REQUIRED</prop>
                <prop key="change*">PROPAGATION_REQUIRED</prop>
                <prop key="update*">PROPAGATION_REQUIRED</prop>
                <prop key="delete*">PROPAGATION_REQUIRED</prop>
                <prop key="do*">PROPAGATION_REQUIRED</prop>
                <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
                <prop key="list*">PROPAGATION_REQUIRES_NEW,readOnly</prop>
                <prop key="get*">PROPAGATION_REQUIRES_NEW,readOnly</prop>
                <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
                <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
                <prop key="remove*">PROPAGATION_REQUIRED</prop>
            </props>
        </property>
    </bean>
 // bean配置项项  ------服务器端配置
//#################################################################################
<bean id="moneyServiceImpl" parent="basePsmProxyTemplate">
	<property name="target">
	    <bean class="com.langgelila.psm.rmi.impl.ProivideMoneyServiceImpl" />
	</property>
</bean>
 <bean id="ydMoneyRmi" class="org.springframework.remoting.rmi.RmiServiceExporter" >
    <property name="serviceName" value="moneyService"/>
    <property name="service" ref="moneyServiceImpl"/>
    <property name="serviceInterface" value="com.langgelila.psm.rmi.iface.ProivideMoneyService"/>
    <property name="registryPort" value="1302"/>
 </bean> 
//###########################客户端配置项######################################
<!-- 远程调用 -->
<bean id="psmMoneyService"
	class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
		<property name="serviceUrl" value="${psmrmiip}"></property>
		<property name="serviceInterface"
			value="com.langgelila.psm.rmi.iface.ProivideMoneyService" />
		<property name="lookupStubOnStartup" value="false" />
		<property name="refreshStubOnConnectFailure" value="true" />
</bean>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值