发表于: 2017-07-06 15:17:46
1 1072
今天完成的事:
1,在服务器端安装Resin。
2,参考师兄的项目,把Tuscany做出来了。与task8相对比,就是把service里面spring-mybatis的这一段代码取消掉了。
<bean id="studentServiceExporter"
class="org.springframework.remoting.rmi.RmiServiceExporter">
<!--serviceName-->
<property name="serviceName" value="studentService"></property>
<!--service实现类-->
<property name="service" ref="studentService"></property>
<!--service接口-->
<property name="serviceInterface" value="com.lyyone.service.StudentService"/>
<!--注册端口号-->
<!--<property name="registryHost" value="127.0.0.1"/>-->
<property name="registryPort" value="8041"/>
<!--给服务注册端口号-->
<property name="servicePort" value="8051"/>
</bean>
<bean id="studentService" class="com.lyyone.service.Impl.StudentServiceImpl"></bean>
代之以一个spring-tuscany.xml的配置文件:
<?xml version= "1.0" encoding ="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca-j/spring/200810"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/sca
http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd" >
<sca:service name="StudentService" target="StudentService" />
<bean id="StudentService" class="com.jnshu.service.impl.StudentServiceImpl" />
<import resource="spring-mybatis.xml"/>
</beans>
和另外一个 .composite的文件:
<?xml version= "1.0" encoding ="UTF-8"?>
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
targetNamespace="http://student" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name= "StudentService" >
<component name="StudentServiceComponent">
<implementation.spring location="spring-tuscany.xml" />
<service name= "StudentService">
<tuscany:binding.rmi uri="rmi://localhost:8081/StudentService" />
</service>
</component >
</composite>
我的理解就是Tuscany是对rmi的一个封装。木钱只知道是这么用,里面的原理还不太懂。
明日计划:
明日请假
遇到的问题:
暂无
收获:
知道了Tuscany的用法。
评论