Tuscany与Spring集成示例
来源:互联网 发布:最新手机淘宝版本开店 编辑:程序博客网 时间:2024/06/09 23:35
使用maven创建tuscany-quickstart项目,其实就是maven web项目,主要是使用自动生成的架构,如下所示
maven引用如下
hello.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://st" name="st"> <component name="HelloComponent"> <implementation.spring location="applicationContext.xml"/> </component></composite>
spring配置文件applicationContext.xml如下,注意为了能够支持SCA标签,需要添加域名空间。但是http://www.springframework.org/schema/sca现在访问不到,会导致该文件报错,但不影响运行。
<?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://www.springframework.org/schema/sca" 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="HelloService" target="HelloServiceImpl" /><bean id="HelloServiceImpl" class="st.HelloServiceImpl" /></beans>类和web.xml文件跟Tuscany发布Web Service示例这篇博客里的一样,注意项目名和包名可能不一致,按实际情况修改。将项目部署于tomcat下运行,测试如下
package test;import org.apache.tuscany.sca.TuscanyRuntime;import org.apache.tuscany.sca.Node;import org.oasisopen.sca.NoSuchServiceException;import st.HelloService;public class HelloTest {public static void main(String[] args) throws NoSuchServiceException {Node node = TuscanyRuntime.runComposite("hello.composite","target/classes");try {HelloService service = node.getService(HelloService.class,"HelloComponent");System.out.println(service.sayHello("World"));} finally {node.stop();}}}
- Tuscany与Spring集成示例
- Tuscany 2.0 与 weblogic 集成
- MyBatis与Spring集成示例
- Spring集成Redis示例
- Tuscany SCA与Spring、Hibernate整合之简洁方法
- 在Web层集成Struts与Spring(示例代码)
- Activiti环境配置、项目搭建、与Spring集成、简单示例
- Activiti环境配置、项目搭建、与Spring集成、简单示例
- Activiti环境配置、项目搭建、与Spring集成、简单示例
- Tuscany发布Web Service示例
- Cxf 集成spring完整示例
- spring集成memcache 示例一
- spring集成memcache 示例二
- spring集成memcache 示例一
- spring集成memcache 示例二
- spring集成memcached示例二
- spring集成memcached示例一
- spring+springMVC+ibatis集成示例
- 如何在项目中加入已存在的文件夹, 注意是文件夹而不是文件
- 寻找最好的笔记软件:三强篇(EverNote、Mybase、Surfulater)
- action传值给页面EL表达式${}接收总为null
- iPhone开发如何捕获提交异常日志
- 你需要知道的16个Linux服务器监控命令
- Tuscany与Spring集成示例
- 股市和期市是两种截然不同的市场机制 ——兼与徐小明先生商榷
- 使用Google Docs的Form创建在线投票时出现的问题
- 删除MI_ONE_PLUS 上面的应用超市
- 如何优化服务器的性能--优化程序
- PLSQL连接oracle数据库配置
- warning C6001: Using uninitialized memory 'ul_next': Lines: 21, 23, 25, 27
- 新的开源产品记录
- Maven3命令学习