struts2,hibernate,spring整合笔记(3)

时间:2023-03-08 17:44:56

struts2,hibernate,spring整合笔记(1)

struts2,hibernate,spring整合笔记(2)

配好struts和hibernate就要开始spring了

老规矩,还是先导入jar包

spring.jar

aspectjrt.jar

aspectjwerver.jar

cglib-nodep-2.1_3.jar

common-logging.jar

c3p0-0.9.1.jar

之后加入配置文件src目录下applicationContext.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"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <context:component-scan base-package="com.spring"></context:component-scan> </beans>

spring采用的注解的方式,设置好包就行了

至此,三大框架已经都导入成功了,接下类就是整合了