码迷,mamicode.com
首页 > 编程语言 > 详细

Eclipse RCP 玩转 Spring

时间:2014-05-27 03:15:56      阅读:324      评论:0      收藏:0      [点我收藏+]

标签:private   java   google   项目   网上   

近来上一个项目想在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     }


Eclipse RCP 玩转 Spring,布布扣,bubuko.com

Eclipse RCP 玩转 Spring

标签:private   java   google   项目   网上   

原文地址:http://8917152.blog.51cto.com/8907152/1412732

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!