首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

Eclipse RCP入门(4)集成SPRING

2012-10-26 
Eclipse RCP入门(四)集成SPRINGEclipse RCP入门(四)在RCP中使用springhttp://sourceforge.net/project/sho

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   这有什么好处啊

热点排行