eclipse下的spring环境配置
1) 工具: (1) jdk
(2) spring.jar 、commons-logging-1.1.1.jar (因为只是做的简单的demo,所以就只用这两个jar包)
spring.jar 是包含有完整发布模块的单个jar 包。但是不包括mock.jar, aspects.jar, spring-portlet.jar, and spring-hibernate2.jar。
commons-logging.jar 包是使用spring的必备包。用来记录程序运行时的活动的日志记录。
在IDE中导入jar后就可以开始编写测试了
2) 在src下写配置文件

相关文件如下:spring-demo.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="testBean" class="com.gdut.springdemo.Spring">
<property name="mySpring">
<value>This is my first spring!</value>
</property>
</bean>
</beans>
测试类:Spring.java
package com.gdut.springdemo;
public class Spring {
private String mySpring;
public void show(){
System.out.println("--message--"+getMySpring());
}
public String getMySpring() {
return mySpring;
}
public void setMySpring(String mySpring) {
this.mySpring = mySpring;
}
}
TestSpring.java
package com.gdut.springdemo;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
public class TestSpring {
public static void main(String[] args) {
ApplicationContext ctx=new FileSystemXmlApplicationContext("src/spring-demo.xml");
Spring spring=(Spring) ctx.getBean("testBean");
spring.show();
}
}
控制台打印: --message--This is my first spring!
eclipse下的spring环境配置的更多相关文章
- windows7+eclipse+hadoop2.5.2环境配置
windows7+eclipse+hadoop2.5.2环境配置 一.hadoop集群环境配置 参考我的前一篇文章(ubuntu + hadoop2.5.2分布式环境配置 http://www. ...
- windows下spark开发环境配置
http://www.cnblogs.com/davidwang456/p/5032766.html windows下spark开发环境配置 --本篇随笔由同事葛同学提供. windows下spark ...
- deepin linux 下C开发环境配置
# deepin linux 下C开发环境配置 ## 前言-----------------------------deepin操作系统商店默认提供了 eclipse for c\c++但是系统没有提 ...
- 【Objective-C】Windows下Objective-C开发环境配置
[Objective-C]Windows下Objective-C开发环境配置 ftp://ftpmain.gnustep.org/pub/gnustep/binaries/windows/ 最近打 ...
- windows下apache+https环境配置
windows下apache+https环境配置 转 https://www.cnblogs.com/sandaizi/p/7519370.html 1.修改配置文件conf/httpd.conf,去 ...
- Linux—CentOS7下python开发环境配置
CentOS7下python开发环境配置 上一篇博客讲了如何在Centos7下安装python3(https://www.cnblogs.com/zivli/p/9937608.html),这一次配置 ...
- Metabase在Windows下的开发环境配置
Metabase在Windows下的开发环境配置 */--> pre.src {background-color: #292b2e; color: #b2b2b2;} Metabase在Wind ...
- Linux下安装Java环境配置
1.下载安装文件 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 2. ...
- Ubuntu 16.04下的LAMP环境配置
在学习开发过程中,每当遇到新的问题时,通常都能在网上搜到解决的方法,但是网上的方法千千万,有些是已经过时了的,有些是跟自己开发环境不同的,总是不能第一时间能找到答案. 而当时遇到的问题可能在今后的开发 ...
随机推荐
- 【Teradata】日期类型计算
1.EXTRACT(抽取年/月/日/时/分/秒) //抽取年/月/日/时/分/秒 SELECT EXTRACT (YEAR FROM CURRENT_DATE); SELECT EXTRACT (M ...
- 2883 -- 【TJOI2018】游园会
Description 小豆参加了\(NOI\)的游园会,会场上每完成一个项目就会获得一个奖章,奖章只会是\(N,O,I\)的字样.在会场.上他收集到了\(K\)个奖章组成的串.兑奖规则是奖章串和兑奖 ...
- PHP程序员遇到职业问题时,是离职?还是坚持?
PHP程序员遇到职业问题时,是离职?还是坚持? 初级php程序员最担心在公司里遇到原本其他程序员开发的项目,他们“跑路”以后的工作就由新程序员完成.而新员工也不懂内部的逻辑,酱紫让程序员很难处理后续的 ...
- byteBuffer的用法
byteBuffer 的三个属性 position limit capacity buffer的一般使用过程 // 1.分配空间// 2.写入数据到Buffer// 3.调用filp()方法// 4. ...
- 转://Oracle 单引号转义
在ORACLE中,单引号有两个作用: 1:字符串是由单引号引用 2:转义. 单引号的使用是就近配对,即就近原则.而在单引号充当转义角色时相对不好理解 1.从第二个单引号开始被视为转义符,如果第二个单引 ...
- 获取列表的索引操作:enumerate
通过循环获取列表的索引操作: 主要使用:enumerate product_list = [['Iphone7',5800], ['Coffee',30], ['疙瘩汤',10], ['Python ...
- Python:Day54 ORM
Django项目中使用mysql DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'books', # ...
- ORA-01034:ORACLE not available ORA-27101:shared memory realm does not exit
ORA-01034:ORACLE not available ORA-27101:shared memory realm does not exit ERROR: ORA-01034:ORACLE ...
- mysql及python交互
mysql在之前写过一次,那时是我刚刚进入博客,今天介绍一下mysql的python交互,当然前面会把mysql基本概述一下. 目录: 一.命令脚本(mysql) 1.基本命令 2.数据库操作命令 3 ...
- 微信小程序web-view页面安卓下显示空白的解决办法!!!
web-view页面在你向地址拼接参数展示页面时,在安卓上有时会显示空白 解决方案: A: 普通不需要参数的话可以直接把地址写在src里,不要去在onLoad里获取你的全局变量后再赋值. B: 如果需 ...