eclipse 中配置spring

来源:互联网 发布:文笔好的网文推荐知乎 编辑:程序博客网 时间:2024/06/02 02:07
1. 安装Eclipse3.7
 
    推荐使用:Eclipse Classic版本
 
    下载地址:http://www.eclipse.org/downloads/或http://download.eclipse.org/eclipse/downloads/
 
2. 安装SpringIDE
 
    如果要支持可视化操作需先安装:http://download.eclipse.org/tools/ajdt/37/update/
 
    SpringIDE更新地址:http://dist.springsource.com/release/TOOLS/update/e3.7
 
    安装选择:Spring IDE core,Spring IDE AOP extension,Spring IDE OSGi extension,
 
    Spring IDE AJDT integration
 
3. Configuring the Target Platform
 
3.1 Configuration without Spring IDE Support
 
    (1)临时创建一个目录:TargetPlatform,推荐在该目录下在新建一级目录bundles, 将SpringDM所需要的JAR以
 
    及所需要的依赖JAR均放置在 该目录 下;
 
    (2) 在Eclipse中选择Window>Preference>Plug-in Development>Target Platform>Add>Noting:Start
 
    whith an enpty target defination>Next>Add>Directory>Browse至具体包含Bundle的目录;
 
    (3) 激活该Target:Target下的Defination对当前的Workspace只能有一个是Active的,选择新建的Checkbox
 
    选择Apply。
 
3.2 Using SpringIDE Support for the Target Platfomr
 
    在Eclipse中选择Window>Preference>
 
    Plugin Development>TargetPlatform>Add>Template:Spring Dynamic Modules for OSGi(tm)
 
    Service Platform 1.1.2,Eclipse将自动识别出本软件自带的相关的JAR Bundle组件。
 
3.3 激活SpringIDE支持该工程
 
    右击项目名称,在上下文菜单中选择"Spring Tools","Add Spring Project Nature"。
 
4. 开发
 
    (1) 创建SpringDM配置文件:
 
    New > Others > Spring > Spring Bean Configuration File, 输入File Name:osgi-context.xml;
 
    (2) 多个Spring 配置文件中代码自动完成设置:项目名称右击,选择Properties>Spring>BeanSupport
 
    >Config Set
 
    (3) Web Component组件开发
 
    需在MANIFEST.MF中增加:Bundle-ClassPath;
 
    需将Output目录改成:ProjectName/classes。
原创粉丝点击