Eclipse RCP 玩转 Spring

近来上一个项目想在Eclipse RCP中使用Spring,在网上Google了一下发现这方面的材料比较少,晓得Spring自个有个Spring-OSGI的项目,能够在Spring中装备OSGI效劳。但是,我仅仅想在RCP中引进Spring来管理Java Bean,不想去研讨那个东西。所以,看看有没有啥简略的方法来处理这个疑问。在陈刚的BlOG中找到了疑问的有些答案。
       
所以,我在RCP项目的activator class中加入了

 private ApplicationContext ctx;
 2 
 3     private void initializeApplicationContext() {
 4         ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
 5         try{
 6             Thread.currentThread().setContextClassLoader(getDefault().getClass().getClassLoader());
 7             this.ctx = new FileSystemXmlApplicationContext(ProjectUtil.toFullPath("properties/applicationContext.xml"));
 8         } finally {
 9             Thread.currentThread().setContextClassLoader(oldLoader);
10         }
11     }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值