一些Spring3的包,就略过了.
项目组织图1
项目组织图2
spring配置文件
<?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-3.0.xsd">
<bean id ="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name = "dataSource">
<ref local="dataSource"/>
</property>
</bean>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="/WEB-INF/conf/jdbc.properties"/>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<bean id="userDAO" class="com.test.dao.UserDao">
<property name="jdbcTemplate">
<ref bean="jdbcTemplate" />
</property>
</bean>
<bean id="TestBo"
class="test.TestBo">
</bean>
<bean id="TestAction" class="test.TestAction">
</bean>
</beans>
总体配置下来,感觉就数据管理部分有简化, 但自己也得去写各个实体类对应的RowMapper,没有简化多少工作。