在MyEclipse中使用Spring,跨出Spring伟大的一步
来源:互联网 发布:mac苹果手机铃声设置 编辑:程序博客网 时间:2024/06/11 10:00
1.建一个java web工程项目,名字是:blog.csdn.net.daliu
2.建俩个包,一个名字是org.spring.dao,另外一个是:org.spring.test
3.导入相应的jar包。可以在这里下载到相对应的包:
http://pan.baidu.com/s/1jf5sq
完整代码如下:
5.在org.spring.test 下新建testCase.java文件,用于测试。
2.建俩个包,一个名字是org.spring.dao,另外一个是:org.spring.test
3.导入相应的jar包。可以在这里下载到相对应的包:
http://pan.baidu.com/s/1jf5sq
如下图:
完整代码如下:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa"xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd"></beans>
5.在org.spring.test 下新建testCase.java文件,用于测试。
完整代码如下:
package org.spring.test;import org.junit.Test;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;public class testCase {@Testpublic void test() {String config = "applicationContext.xml";ApplicationContext ac = new ClassPathXmlApplicationContext(config);System.out.println(ac);}}
在控制台出现以下的提示,说明配置成功!!
0 0
- 在MyEclipse中使用Spring,跨出Spring伟大的一步
- 在 Longhorn 道路上跨出新的一步
- [转]在 Longhorn 道路上跨出新的一步
- 在Myeclipse中查看Spring.Jar的源代码
- MyEclipse中Spring工程使用@Resource注释的问题
- 在Spring中使用C3P0的方法
- 【Spring】在WEB应用中使用Spring
- Spring学习9-MyEclipse中Spring工程使用@Resource注释的问题
- myeclipse中配置spring
- MyEclipse中添加Spring
- 在Spring中使用JDO
- 在jsp中使用spring
- 在Spring中使用iBatis
- 在Spring中使用Hibernate
- 在spring中使用jms
- 在Spring中使用Quartz
- 在Spring中使用JMS
- 在JSP中使用Spring
- ArrayList source code相关方法阅读
- eclipse中导入文件到模拟器
- hdu1272小希的迷宫(并查集)
- chrome扩展开发手记<1>-需求分析
- flash打印指定页码的报表
- 在MyEclipse中使用Spring,跨出Spring伟大的一步
- C++中智能指针的设计和使用
- UVa做题阶段性总结(2014-11-21)
- asdasdasd
- 查找数字的三种算法的时间
- 依赖注入框架Autofac的简单使用
- Android JNI 使用的数据结构JNINativeMethod详解
- 在VS中设置比较和谐的字体和颜色的方法
- Hibernate持久层全面描述