发表于: 2019-10-14 18:47:47

1 896


今天完成的事情:

最后一次做tuscany和spring的整合,还是不行,数组越界

<composite
       xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
       xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
       targetNamespace="http://tuscany"
       name="Tuscany">

   <component name="StudentComponent">
<!--        <implementation.java class="com.jnshu.service.StudentTuscanyServiceImpl"/>-->
       <implementation.spring location="applicationContext.xml" />
       <service name="studentTuscanyService">
           <interface.java interface="com.jnshu.service.StudentTuscanyService"/>
           <tuscany:binding.rmi uri="rmi://127.0.0.1:8099/studentTuscany"/>
       </service>
       <reference name="checkNumService" target="CheckNumComponent"/>
       <reference name="jobService" target="JobComponent"/>
       <reference name="userService" target="UserComponent"/>
   </component>
   <component name="CheckNumComponent">
       <implementation.java class="com.jnshu.service.CheckNumServiceImpl"/>
   </component>
   <component name="JobComponent">
       <implementation.java class="com.jnshu.service.JobServiceImpl"/>
   </component>
   <component name="UserComponent">
       <implementation.java class="com.jnshu.service.UserServiceImpl"/>
   </component>
</composite>



<sca:service name="studentTuscanyService" target="studentTuscanyService" type="com.jnshu.service.StudentTuscanyService"/>
<bean id="studentTuscanyService" class="com.jnshu.service.StudentTuscanyServiceImpl"/>
<sca:reference name="userService" type="com.jnshu.service.UserService" />
<sca:reference name="checkNumService" type="com.jnshu.service.CheckNumService"/>
<sca:reference name="jobService" type="com.jnshu.service.JobService"/>



不做了。去弄springboot。直接弄下就是了。

知道怎么连接就是了。

package com.jnshu.service;

public interface Say {
   String sayHello(String text);
}
package com.jnshu.service;

public class SayImpl implements Say {
   public String sayHello(String text) {
       return text+"完成";
   }
}


tuscany的配置文件

<composite
       xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
       xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
       targetNamespace="http://demo"
       name="demo">

   <component name="say">
       <implementation.java class="com.jnshu.service.SayImpl"/>
       <service name="SayImpl">
           <interface.java interface="com.jnshu.service.Say"/>
           <tuscany:binding.rmi uri="rmi://127.0.0.1:8099/tuscany" />
       </service>
   </component>
</composite>


package com.jnshu;

import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;

public class Service {
   public static void main(String[] args) {
       Node node = NodeFactory.newInstance().createNode("demo.composite");
       node.start();
       System.out.println("service启动");
   }
}

启动service端


学了下springboot的web


package com.jnshu.controller;

import com.jnshu.service.Say;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

@Controller
public class CilentWeb {

   @RequestMapping("/")
   @ResponseBody
   public String say() throws RemoteException, NotBoundException, MalformedURLException {
       Say say= (Say) Naming.lookup("rmi://localhost:8099/tuscany");
       return say.sayHello("开始");
   }
}


这样就行了。


明天计划的事情:

为了复盘学习springboot等,还有个安全框架,哦,对,还有复盘评审。


遇到的问题:

那个数组越界问题,不知道从哪里下手,不弄了。


用springboot的时候,一直连接不上,显示

Whitelabel Error Page

后来发现,你写的代码要在main方法的同包或子包下,目录不能乱。

收获:

开始springboot。



任务总结:

任务名称:JAVA=TASK9

成果链接:

任务耗时:9月26日-9月15日

技能脑图:官方

个人脑图


任务总结:tuscany用的人不是少,是太少了,一个东西再好,被淘汰了就是被淘汰了。虽然说够用就好,不过还是喜欢更新的东西。








返回列表 返回列表
评论

    分享到