Spring 简单整合 hibernate 例子
applicationContext.xml
package com.test;import org.springframework.context.ApplicationContext;import org.springframework.context.support.FileSystemXmlApplicationContext;public class MainTest{public static void main(String[] args){/* * 下面读配置文件和取bean的代码,可以写成factory */ApplicationContext ctx = new FileSystemXmlApplicationContext("src/applicationContext.xml");Test1Dao test1Dao = (Test1Dao) ctx.getBean("test1dao");Test1 test1 = new Test1();test1.setName("tianjuntest");test1Dao.saveOrUpdate(test1);}}
?
最低要求JAR包:
commons-collections.jar
commons-dbcp.jar
commons-logging.jar
commons-pool.jar
dom4j-1.6.1.jar
hibernate3.jar
javassist-3.9.0.GA.jar
jaybird-full-2.0.1.jar
log4j-1.2.14.jar
slf4j-api-1.5.8.jar
slf4j-nop-1.5.2.jar
spring.jar
?
?
?