读书人

Eclipse RCP入门(4)集成SPRING

发布时间: 2012-10-26 10:30:58 作者: rapoo

Eclipse RCP入门(四)集成SPRING
Eclipse RCP入门(四)

在RCP中使用spring
http://sourceforge.net/project/showfiles.php?group_id=145348


前人已经写了这个开源包了。下载过来。
把JAR包:
net.sourceforge.eclipsespring_0.1.0.jar
net.sourceforge.eclipsespring.example_0.1.0.jar
放在eclipse下面的plugins下面。嘿嘿。example其实可以不放。

打开plugin.xml文件
把如下内容加入
<extension
point="net.sourceforge.eclipsespring.beanFactoryContributors">
<beanFactoryContributor
encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>

<extension
point="net.sourceforge.eclipsespring.beanFactoryContributors">
<beanFactoryContributor
};
}
}

spring的配置文件applicationContext.xml如下:
<?xml version="1.0"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<bean id="userManager" singleton="false" class="com.sillycat.views.SampleView">
<property name="userManager">
<ref local="userManager"/>
</property>
</bean>

</beans>

userManager是个例子,UserManagerImpl.java如下:
package com.sillycat.services.impl;

import com.sillycat.services.UserManager;

public class UserManagerImpl implements UserManager {

public String getCurrentUserName() {
return System.getProperty("user.name");
}

}
1 楼 fy_kenny 2011-10-18 这有什么好处啊

读书人网 >Eclipse开发

热点推荐