Jquery+Spring3+Struts2+Ibatis3框架源代码工程(含权限)
开发框架选择 Jquery1.6 + strust2.1 + spring3.0 + ibatis3.0 数据库Mysql5
前台Jquery ,
Jquery+Spring3.0+Struts2+Ibatis3框架(含权限),struts2,freemark,java,freemark+struts2,js(Jquery)
这就是我们常说的 SSI 框架。
此文档仅供初手、新人学习,交流。
一、 框架结构图:

二、 struts配置
工程目录
src
----struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<!-- struts的URL扩展名 -->
<constant name="struts.action.extension" value="do" />
<!-- 允许访问静态成员变量 -->
<constant name="struts.ognl.allowStaticMethodAccess" value="true" />
<constant name="struts.custom.i18n.resources" value="i18n/messages"/>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.enable.SlashesInActionNames" value="true" />
<constant name="struts.multipart.maxSize" value="1048576000"/>
<constant name="struts.multipart.saveDir" value="/tmp"/>
<package name="custom-default" extends="struts-default">
<result-types>
<result-type name="direct" class="cn.org.rapid_framework.struts2.dispatcher.DirectResult"/>
</result-types>
<default-interceptor-ref name="paramsPrepareParamsStack"/>
</package>
<!-- 修改为你自己的namespace -->
<package name="default" namespace="/" extends="custom-default">
<!-- 通过URL访问的路径是 /namesapce/Entity/method.do -->
<action name="*/*/*" method="{3}" class="com.health.system.action.{1}.{2}Action">
<result name="*" type="direct">通过Action直接返回,这一行无需修改</result>
</action>
<!--
<action name="*/*" method="{2}" class="com.mylink.mipbs.action.cp.{1}Action">
<result name="*" type="direct">通过Action直接返回,这一行无需修改</result>
</action>
-->
<!-- 打开以下配置用于使用struts2自带的验证框架
<action name="*/save" method="save" class="com.company.system.action.{1}Action">
<result name="input" type="dispatcher">/demo/{1}/create.do</result>
<result name="*" type="direct">通过Action直接返回</result>
</action>
-->
</package>
</struts>
三、 web.xml 配置
工程目录
web
--WEB-INF
----struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- session超时定义,单位为分钟 -->
<session-config>
<session-timeout>20</session-timeout>
</session-config>
<!-- Spring ApplicationContext配置文件的路径�,可使用通配符,多个路径用�1,号分隔
此参数用于后面的Spring-Context loader -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:healthspring/*.xml</param-value>
</context-param>
<resource-ref>
<res-ref-name>jdbc/DSjwzhxt</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<filter>
<filter-name>sessionTimeOutFilter</filter-name>
<filter-class>
com.health.system.springSecurity.SessionTimeOutFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>sessionTimeOutFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>
org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 著名 Character Encoding filter -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>
org.springframework.web.filter.CharacterEncodingFilter
</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--Spring ApplicationContext 载入 -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- 使Spring支持request与session的scope,如:<bean id="loginAction" class="com.foo.LoginAction" scope="request"/> -->
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<!-- Spring 刷新Introspector防止内存泄露 -->
<listener>
<listener-class>
org.springframework.web.util.IntrospectorCleanupListener
</listener-class>
</listener>
<filter>
<filter-name>struts2-cleanup</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ActionContextCleanUp
</filter-class>
</filter>
<filter>
<filter-name>struts2Filter</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2-cleanup</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2Filter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>
四、Spring 配置
工程目录
src
---healthspring
--------------applicationContext-ibatis3-dao.xml
--------------applicationContext-resource.xml
--------------applicationContext-security.xml
--------------applicationContext-service.xml
4.1 applicationContext-ibatis3-dao.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- Spring iBatis SqlMapClient -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:/com/health/system/properties/configuration.xml"/>
<property name="mappingLocations">
<value>classpath*:/com/**/dao/**/**/*Mapper.xml"</value>
</property>
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- Spring iBatisTemplate -->
<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient" ref="sqlMapClient"/>
</bean>
<!-- Transaction manager for a single JDBC DataSource -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="sqlSessionFactory" class="com.health.system.javacommon.SqlSessionFactoryFactoryBean">
<property name="configLocation" value="classpath:/com/health/system/properties/configuration.xml"/>
<property name="mapperLocations" value="classpath*:/com/**/dao/**/**/*Mapper.xml"/>
<property name="dataSource" ref="dataSource"/>
</bean>
</beans>
4.2 applicationContext-resource.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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
default-autowire="byName" default-lazy-init="false">
<!-- 属性文件读入,使用rapid中的JdbcPlaceholderConfigurer则可以从数据库读取配置信息 -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:/com/health/system/properties/jdbc.properties</value>
<value>classpath*:/com/health/system/properties/pool.properties</value>
</list>
</property>
</bean>
<!-- 数据源定义,使用Apache DBCP 连接池 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driver}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="initialSize" value="${jdbc.initialSize}"/>
<property name="maxActive" value="${jdbc.maxActive}"/>
<property name="maxIdle" value="${jdbc.maxIdle}"/>
<property name="minIdle" value="${jdbc.minIdle}"/>
<property name="maxWait" value="${jdbc.maxWait}"/>
<property name="logAbandoned" value="${jdbc.logAbandoned}" />
<property name="removeAbandoned" value="${jdbc.removeAbandoned}" />
<property name="removeAbandonedTimeout" value="${jdbc.removeAbandonedTimeout}" />
</bean>
<!-- 数据源定义,使用Apache DBCP 连接池 -->
<!--
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>java:comp/env/jdbc/DSjwzhxt</value></property>
</bean>
-->
<!-- 用于测试或demo的hsql的内存dataSource,可以在创建数据库时运行指定的初始化sql语句,如建表,插入测试数据,sql语句之间使用分号";"分隔 -->
<!--
<bean id="dataSource" class="cn.org.rapid_framework.test.hsql.HSQLMemDataSourceFactoryBean">
<property name="encoding" value="UTF-8"/>
<property name="scriptLocations">
<value>classpath*:hsql_test_scripts.sql</value>
</property>
<property name="sqlScript">
<value>
create table blog(id int);
insert into blog values (1);
</value>
</property>
</bean>
-->
<!-- 以 @Transactional 标注来定义事务 -->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<!-- 支持 @AspectJ 标记-->
<!-- <aop:aspectj-autoproxy/>-->
<!-- 以AspectJ方式 定义 事务 -->
<!--
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* javacommon.base.BaseManager.*(..))" advice-ref="txAdvice"/>
<aop:advisor pointcut="execution(* com.*..*.service.*Manager.*(..))" advice-ref="txAdvice"/>
</aop:config>
-->
<!-- 基本事务定义,使用transactionManager作事务管理,默认get* find*方法的事务为readonly,其余方法按默认设置.
默认的设置请参考Spring文档事务一章. -->
<!--
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="find*" read-only="true"/>
<tx:method name="get*" read-only="true"/>
<tx:method name="query*" read-only="true"/>
<tx:method name="*" read-only="false"/>
</tx:attributes>
</tx:advice>
-->
<!-- 用于持有ApplicationContext,可以使用ApplicationContextHolder.getBean('xxxx')的静态方法得到spring bean对象 -->
<!-- <bean class="cn.org.rapid_framework.util.ApplicationContextHolder"/> -->
</beans>
4.3 security权限配置
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"
default-autowire="byName" default-lazy-init="false">
<global-method-security pre-post-annotations="enabled">
</global-method-security>
<http use-expressions="true" auto-config="true" access-denied-page="/timeOut.jsp">
<form-login login-page="/login.jsp"
always-use-default-target="true"
default-target-url="/index.jsp"
authentication-failure-url="/login.jsp?error=1"/>
<logout logout-success-url="/index.jsp" />
<!-- <remember-me /> -->
<session-management invalid-session-url="/timeOut.jsp" session-fixation-protection="none">
<concurrency-control max-sessions="10"
error-if-maximum-exceeded="true" />
</session-management>
<!--
增加一个filter,这点与Acegi是不一样的,不能修改默认的filter了,
这个filter位于FILTER_SECURITY_INTERCEPTOR之前
-->
<custom-filter ref="myFilter"
before="FILTER_SECURITY_INTERCEPTOR" />
</http>
<!--
一个自定义的filter,必须包含authenticationManager,accessDecisionManager,securityMetadataSource三个属性,
我们的所有控制将在这三个类中实现,解释详见具体配置
-->
<beans:bean id="myFilter"
class="com.health.system.springSecurity.MyFilter">
<beans:property name="authenticationManager"
ref="authenticationManager">
</beans:property>
<beans:property name="accessDecisionManager"
ref="accessDecisionManager">
</beans:property>
<beans:property name="filterInvocationSecurityMetadataSource"
ref="filterInvocationSecurityMetadataSource" />
</beans:bean>
<beans:bean id="accessDecisionManager"
class="com.health.system.springSecurity.MyAccessDecisionManager">
</beans:bean>
<beans:bean id="filterInvocationSecurityMetadataSource"
class="com.health.system.springSecurity.MyInvocationSecurityMetadataSource">
</beans:bean>
<!-- 验证配置 , 认证管理器,实现用户认证的入口,主要实现UserDetailsService接口即可 -->
<authentication-manager alias="authenticationManager">
<authentication-provider
user-service-ref="userDetailServiceImpl">
<password-encoder ref="passwordEncoder"></password-encoder>
</authentication-provider>
</authentication-manager>
<beans:bean id="userDetailServiceImpl"
class="com.health.system.springSecurity.UserDetailServiceImpl">
</beans:bean>
<beans:bean id="passwordEncoder"
class="com.health.system.springSecurity.MyPasswordEncoder">
</beans:bean>
<!-- 获取spring上下文 -->
<beans:bean id="SpringContextUtil"
class="com.health.system.javacommon.util.SpringContextUtil">
</beans:bean>
</beans:beans>
4.4 applicationContext-service.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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-autowire="byName" default-lazy-init="false">
<!-- component-scan自动搜索@Component , @Controller , @Service , @Repository等标注的类 -->
<context:component-scan base-package="com.**.dao.*"/>
<context:component-scan base-package="com.**.service.*.impl" />
<context:annotation-config /><!--开启注解-->
<!-- 获取spring上下文 -->
<bean id="SpringContextUtil"
class="com.health.system.javacommon.util.SpringContextUtil">
</bean>
<bean id="threadPoolTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="${pool.corePoolSize}" />
<property name="keepAliveSeconds" value="${pool.keepAliveSeconds}" />
<property name="maxPoolSize" value="${pool.maxPoolSize}" />
<property name="queueCapacity" value="${pool.queueCapacity}" />
</bean>
<!-- 被调借口 begin -->
<!-- 被调借口 end -->
</beans>
五、权限配置
Spring Security是基于Spring的的权限认证框架,对于Spring和Acegi已经比较熟悉的同学对于之前的配置方式应该已经非常了解。接下来的例子,将向大家展示Spring Security基于schema的配置方式。
5.1 配置文件图

5.2 JSON菜单
[
{'id':'6', 'name':'客户管理','nodes': [
{'id':'601','trl':'pages/organiza/DataOrganizations/add.jsp','name':'add'},
{'id':'602','trl':'pages/organiza/DataOrganizations/index.jsp','name':'list'}
],'open':false},
{'id':'1', 'name':'系统管理','nodes': [
{'id':'101','trl':'pages/system/Role/index.jsp','name':'角色管理'},
{'id':'102','trl':'pages/system/Permission/index.jsp','name':'权限管理'},
{'id':'103','trl':'pages/system/RolePermission/index.jsp','name':'角色权限分配'},
{'id':'104','trl':'pages/system/User/index.jsp','name':'操作员管理'}
],'open':false},
{'id':'4', 'name':'个人管理','nodes': [
{'id':'401','trl':'pages/system/User/updateUser.jsp','name':'个人信息修改'},
{'id':'403','trl':'pages/system/User/updatePassword.jsp','name':'修改密码'},
{'id':'404','trl':'pages/system/User/resetPassword.jsp','name':'密码重置'}
], 'open':false}
]
5.3 web.xml 中spring Security 配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
..........
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>
org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
..........
</web-app>
5.3 security 和Spring 集成配置
Spring Security 配置详解
工程目录
src
---healthspring
--------------applicationContext-security.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"
default-autowire="byName" default-lazy-init="false">
<global-method-security pre-post-annotations="enabled">
</global-method-security>
<http use-expressions="true" auto-config="true" access-denied-page="/timeOut.jsp">
<form-login login-page="/login.jsp"
always-use-default-target="true"
default-target-url="/index.jsp"
authentication-failure-url="/login.jsp?error=1"/>
<logout logout-success-url="/index.jsp" />
<!-- <remember-me /> -->
<session-management invalid-session-url="/timeOut.jsp" session-fixation-protection="none">
<concurrency-control max-sessions="10"
error-if-maximum-exceeded="true" />
</session-management>
<!--
增加一个filter,这点与Acegi是不一样的,不能修改默认的filter了,
这个filter位于FILTER_SECURITY_INTERCEPTOR之前
-->
<custom-filter ref="myFilter"
before="FILTER_SECURITY_INTERCEPTOR" />
</http>
<!--
一个自定义的filter,必须包含authenticationManager,accessDecisionManager,securityMetadataSource三个属性,
我们的所有控制将在这三个类中实现,解释详见具体配置
-->
<beans:bean id="myFilter"
class="com.health.system.springSecurity.MyFilter">
<beans:property name="authenticationManager"
ref="authenticationManager">
</beans:property>
<beans:property name="accessDecisionManager"
ref="accessDecisionManager">
</beans:property>
<beans:property name="filterInvocationSecurityMetadataSource"
ref="filterInvocationSecurityMetadataSource" />
</beans:bean>
<beans:bean id="accessDecisionManager"
class="com.health.system.springSecurity.MyAccessDecisionManager">
</beans:bean>
<beans:bean id="filterInvocationSecurityMetadataSource"
class="com.health.system.springSecurity.MyInvocationSecurityMetadataSource">
</beans:bean>
<!-- 验证配置 , 认证管理器,实现用户认证的入口,主要实现UserDetailsService接口即可 -->
<authentication-manager alias="authenticationManager">
<authentication-provider
user-service-ref="userDetailServiceImpl">
<password-encoder ref="passwordEncoder"></password-encoder>
</authentication-provider>
</authentication-manager>
<beans:bean id="userDetailServiceImpl"
class="com.health.system.springSecurity.UserDetailServiceImpl">
</beans:bean>
<beans:bean id="passwordEncoder"
class="com.health.system.springSecurity.MyPasswordEncoder">
</beans:bean>
<!-- 获取spring上下文 -->
<beans:bean id="SpringContextUtil"
class="com.health.system.javacommon.util.SpringContextUtil">
</beans:bean>
</beans:beans>
5.5 验证事物处理

六、 数据源配置
工程目录
src
---healthspring
--------------applicationContext-resource.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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
default-autowire="byName" default-lazy-init="false">
<!-- 属性文件读入,使用rapid中的JdbcPlaceholderConfigurer则可以从数据库读取配置信息 -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:/com/health/system/properties/jdbc.properties</value>
<value>classpath*:/com/health/system/properties/pool.properties</value>
</list>
</property>
</bean>
<!-- 数据源定义,使用Apache DBCP 连接池 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driver}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="initialSize" value="${jdbc.initialSize}"/>
<property name="maxActive" value="${jdbc.maxActive}"/>
<property name="maxIdle" value="${jdbc.maxIdle}"/>
<property name="minIdle" value="${jdbc.minIdle}"/>
<property name="maxWait" value="${jdbc.maxWait}"/>
<property name="logAbandoned" value="${jdbc.logAbandoned}" />
<property name="removeAbandoned" value="${jdbc.removeAbandoned}" />
<property name="removeAbandonedTimeout" value="${jdbc.removeAbandonedTimeout}" />
</bean>
<!-- 数据源定义,使用Apache DBCP 连接池 -->
<!--
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>java:comp/env/jdbc/DSjwzhxt</value></property>
</bean>
-->
<!-- 用于测试或demo的hsql的内存dataSource,可以在创建数据库时运行指定的初始化sql语句,如建表,插入测试数据,sql语句之间使用分号";"分隔 -->
<!--
<bean id="dataSource" class="cn.org.rapid_framework.test.hsql.HSQLMemDataSourceFactoryBean">
<property name="encoding" value="UTF-8"/>
<property name="scriptLocations">
<value>classpath*:hsql_test_scripts.sql</value>
</property>
<property name="sqlScript">
<value>
create table blog(id int);
insert into blog values (1);
</value>
</property>
</bean>
-->
<!-- 以 @Transactional 标注来定义事务 -->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<!-- 支持 @AspectJ 标记-->
<!-- <aop:aspectj-autoproxy/>-->
<!-- 以AspectJ方式 定义 事务 -->
<!--
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* javacommon.base.BaseManager.*(..))" advice-ref="txAdvice"/>
<aop:advisor pointcut="execution(* com.*..*.service.*Manager.*(..))" advice-ref="txAdvice"/>
</aop:config>
-->
<!-- 基本事务定义,使用transactionManager作事务管理,默认get* find*方法的事务为readonly,其余方法按默认设置.
默认的设置请参考Spring文档事务一章. -->
<!--
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="find*" read-only="true"/>
<tx:method name="get*" read-only="true"/>
<tx:method name="query*" read-only="true"/>
<tx:method name="*" read-only="false"/>
</tx:attributes>
</tx:advice>
-->
<!-- 用于持有ApplicationContext,可以使用ApplicationContextHolder.getBean('xxxx')的静态方法得到spring bean对象 -->
<!-- <bean class="cn.org.rapid_framework.util.ApplicationContextHolder"/> -->
</beans>
6.2 数据源配置文件
工程目录
--src
-------com.health.system
------------------properties
-------------------------jdbc.jdbc.properties
-------------------------pool.properties
jdbc.username=root
jdbc.password=123456
jdbc.url=jdbc:mysql://127.0.0.1:3306/你的数据库明?characterEncoding=utf-8
jdbc.driver=com.mysql.jdbc.Driver
jdbc.initialSize=5
jdbc.maxActive=10
jdbc.maxIdle=10
jdbc.minIdle=15
jdbc.logAbandoned=true
jdbc.removeAbandoned=true
jdbc.removeAbandonedTimeout=1000
jdbc.maxWait=5000
pool.corePoolSize=20
pool.keepAliveSeconds=60
pool.maxPoolSize=64
pool.queueCapacity=64
spring3 里各个jar的作用
org.springframework.aop- 3.0.6.RELEASE--------------------Spring的面向切面编程,提供AOP(面向切面编程)实现
org.springframework.asm- 3.0.6.RELEASE-------------------Spring独立的asm程序,相遇Spring2.5.6的时候需要asmJar 包3.0.6开始提供他自己独立的asmJar
org.springframework.aspects- 3.0.6.RELEASE---------------Spring提供对AspectJ框架的整合
org.springframework.beans-3.0.6.RELEASE------------------SpringIoC(依赖注入)的基础实现
org.springframework.context.support-3.0.6.RELEASE-------Spring-context的扩展支持,用于MVC方面
org.springframework.context-3.0.6.RELEASE-----------------Spring提供在基础IoC功能上的扩展服务,此外还提供许多企业级服务的支持,如邮件服务、任务调度、JNDI定位、EJB集成、远程访问、缓存以及各种视图层框架的封装等
org.springframework.core-3.0.6.RELEASE--------------------Spring3.0.6的核心工具包
org.springframework.expression-3.0.6.RELEASE------------Spring表达式语言
org.springframework.instrument.tomcat-3.0.6.RELEASE---Spring3.0.6对Tomcat的连接池的集成
org.springframework.instrument-3.0.6.RELEASE------------Spring3.0.6对服务器的代理接口
org.springframework.jdbc-3.0.6.RELEASE---------------------对JDBC的简单封装
org.springframework.jms-3.0.6.RELEASE----------------------为简化JMS API的使用而作的简单封装
org.springframework.orm-3.0.6.RELEASE----------------------整合第三方的ORM框架,如hibernate,ibatis,jdo,以及 spring的JPA实现
org.springframework.oxm-3.0.6.RELEASE---------------------Spring 对Object/XMl的映射支持,可以让Java与XML之间来回切换
org.springframework.test-3.0.6.RELEASE----------------------对Junit等测试框架的简单封装
org.springframework.transaction-3.0.6.RELEASE------------为JDBC、Hibernate、JDO、JPA等提供的一致的声明式和编程式事务管理
org.springframework.web.portlet-3.0.6.RELEASE-------------基于protlet的MVC实现
org.springframework.web.servlet-3.0.6.RELEASE------------基于servlet的MVC实现
org.springframework.web.struts-3.0.6.RELEASE-------------整合Struts的时候的支持
org.springframework.web-3.0.6.RELEASE---------------------SpringWeb下的工具包
jar包 用途
axis.jar SOAP引擎包
commons-discovery-0.2.jar 用来发现、查找和实现可插入式接口,提供一些一般类实例化、单件的生命周期管理的常用方法.
jaxrpc.jar Axis运行所需要的组件包
saaj.jar 创建到端点的点到点连接的方法、创建并处理SOAP消息和附件的方法,以及接收和处理SOAP错误的方法.
wsdl4j-1.5.1.jar Axis运行所需要的组件包
activation.jar JAF框架的jar包
annotations-api.jar 使用注解所需jar
ant.jar 用于自动化调用程序完成项目的编译,打包,测试等
aopalliance-1.0.jar 支持Spring AOP
asm-2.2.3.jar ASM字节码库
asm-commons-2.2.3.jar ASM字节码库
asm-util-2.2.3.jar Java字节码操纵和分析框架
aspectjrt.jar 处理事务和AOP所需的包
aspectjweaver.jar 处理事务和AOP所需的包
axiom-api-1.2.7.jar Axis 对象模型
axiom-impl-1.2.7.jar Axis 对象模型
bcprov-jdk15-140.jar 基于java1.5 的加密算法实现
bfmclientmodel.jar 使用WebSphere所需jar包
bpcclientcore.jar 使用WebSphere所需jar包
bpe137650.jar 提供远程访问BPE容器的实现。
bsh-2.0b4.jar 解决负载逻辑运算
c3p0-0.9.0.jar 开放源代码的JDBC连接池
cglib-nodep-2.1_3.jar Spring中自动代理所需jar包
cobertura.jar 测量测试覆盖率
commons-beanutils-1.7.0.jar 动态的获取/设值Java Bean的属性
commons-chain-1.1.jar 实现责任链设计模式的Java 类库
commons-codec-1.3.jar 用来处理常用的编码方法的工具类包,例如DES、SHA1、MD5、Base64等等
commons-collections-3.1.jar 对标准java Collection的扩展
commons-collections.jar 对标准java Collection的扩展
commons-digester-1.8.jar 用于处理struts-config.xml配置文件
commons-fileupload-1.1.1.jar struts上传文件
commons-httpclient-3.1.jar 用来简化HTTP客户端与服务器端进行各种通信编程实现
commons-io-1.1.jar 针对java.io.InputStream和Reader进行了扩展
commons-lang-2.4.jar 对java.lang.*的扩展
commons-logging-1.1.1.jar 日志包
commons-pool-1.3.jar 实现对象池化框架
commons-validator-1.3.1.jar 用来把验证规则程序提取出来,以供重复使用
db2jcc.jar java连接DB2所需jar
db2jcc_license_cu.jar java连接DB2所需jar
dom4j-1.6.1.jar 解析XML
ehcache-1.2.4.jar hibernate的二级缓存如果用ehcache的时候需要此jar包
emf.jar 基于Eclipse的模型框架
ezmorph-1.0.6.jar 使用JSON所需的jar包
FastInfoset-1.2.2.jar 使用WebService所需的jar包
freemarker-2.3.8.jar Strus2支持的一种表现层框架
geronimo-activation_1.1_spec-1.0.2.jar Apache Geronimo所带jar包,
geronimo-annotation_1.0_spec-1.1.1.jar Apache Geronimo所带jar包
geronimo-javamail_1.4_spec-1.3.jar Apache Geronimo所带jar包
geronimo-jaxws_2.1_spec-1.0.jar Apache Geronimo所带jar包
geronimo-jms_1.1_spec-1.1.1.jar Apache Geronimo所带jar包
geronimo-servlet_2.5_spec-1.2.jar Apache Geronimo所带jar包
geronimo-stax-api_1.0_spec-1.0.1.jar Apache Geronimo所带jar包
hibernate3.jar Hibernate3的核心jar包
htmclientmodel.jar 使用WebSphere所需jar包
jakarta-oro.jar 一套文本处理工具,提供per15.0兼容的表达式,AWK-like表达式,Glob表达式。
javassist.jar Javassist 字节码解释器
jaxb-api-2.1.jar 使用WebService所需的jar包
jaxb-impl-2.1.7.jar 使用CXF所需jar包
jaxb-xjc-2.1.7.jar 使用CXF所需jar包
jaxen-1.1.1.jar 解析XML
jcifs-1.2.22.jar 实现单点登陆
jdom2-1.0.jar 解析XML
jdom-1.0.jar 解析XML
jettison-1.0.1.jar 使用CXF所需jar包
jetty-6.1.9.jar Jetty Http服务器jar
jetty-util-6.1.9.jar Jetty Http服务器jar
jra-1.0-alpha-4.jar 使用CXF所需jar包
js-1.6R7.jar 使用CXF所需jar包
json-lib-2.2.3-jdk13.jar 使用JSON所需的jar包
jsonplugin-0.25.jar strus2的JSON插件
jsr311-api-0.8.jar 使用CXF所需jar包
jstl.jar JSTL标签库
jta.jar 标准的 JAVA 事务处理接口
junit.jar 用于单元测试
jxl.jar 通过java操作excel表格的工具类库
ldap.jar JNDI目录服务和LDAO服务器所需的jar
ldapbp.jar JNDI目录服务和LDAO服务器所需的jar
log4j-1.2.15.jar 提供日志功能
mail.jar java发送邮件jar包
neethi-2.0.4.jar 使用CXF所需jar包
odmg-3.0.jar ODMG是一个ORM的规范,Hibernate实现了ODMG规范,这是一个核心的库
ognl-2.6.11.jar struts2中OGNL语言
ojdbc14.jar Oracle数据库驱动包
opensaml-1.1.jar 使用CXF所需jar包
oro-2.0.8.jar Validator框架所需的jar包
oscache-2.1.jar Java 对象的缓存工具
poi-3.1-FINAL-20080629.jar 操作exce所需jar包
poi-contrib-3.1-FINAL-20080629.jar 操作exce所需jar包
poi-ooxml-3.6-20091214.jar 提供对office的word、excel、visio及ppt的操作
poi-ooxml-schemas-3.6-20091214.jar 提供对office的word、excel、visio及ppt的操作
poi-scratchpad-3.1-FINAL-20080629.jar 提供对office的word、excel、visio及ppt的操作
processCommon.jar IBM WebSphere 运行所需jar
ProcessCommonLibrary.jar IBM WebSphere 运行所需jar
processIdentity.jar IBM WebSphere 运行所需jar
ProcessInformation.jar 进程监视软件包
proxool-0.9.1.jar 数据库连接池
proxool-cglib.jar 数据库连接池
quartz-1.6.0.jar 开源作业调度框架
saaj-api-1.3.jar 使用axis所需的jar
saaj-impl-1.3.2.jar 使用axis所需的jar
serializer-2.7.1.jar XML序列化
slf4j-jdk14-1.5.6.jar 整合各种日志框架的工具
spring208.jar spring核心框架
spring-ldap-1.2-RC1.jar spring下LDAP
spring-mock.jar spring的测试框架
standard.jar 使用JSTL标签库所需的jar
stax-api-1.0.1.jar 解析XML
struts2-core-2.0.14.jar struts2核心jar
struts2-spring-plugin-2.0.6.jar struts2整合Spring所需jar
taglibs-datetime.jar Apache开源组织提供标签库,用于格式化日期。
taglibs-mailer.jar 用于发送邮件
taglibs-string.jar Apache开源组织提供标签库,用于对String的操作。
task137650.jar Portal技术在SOA系统集成应用中实现所需的jar
utility.jar Apache开源组织提供标签库
velocity-1.5.jar 一个免费的开源模板框架
wsdl4j-1.6.2.jar 用来解析服务的WSDl文件
wss4j-1.5.4.jar 创建CXF所需jar
wstx-asl-3.2.6.jar 创建CXF所需jar
xbean-spring-2.8.jar 使用xfire所需jar
xerces-2.6.2.jar XML解析器
xfire-all-1.2.6.jar 用于实现WebService
XmlSchema-1.1.jar 使用xfire所需jar
xwork-2.0.7.jar WebWork核心jar
jar包 用途
axis.jar
SOAP引擎包
commons-discovery-0.2.jar
用来发现、查找和实现可插入式接口,提供一些一般类实例化、单件的生命周期管理的常用方法.
jaxrpc.jar
Axis运行所需要的组件包
saaj.jar
创建到端点的点到点连接的方法、创建并处理SOAP消息和附件的方法,以及接收和处理SOAP错误的方法.
wsdl4j-1.5.1.jar
Axis运行所需要的组件包
activation.jar
JAF框架的jar包
annotations-api.jar
使用注解所需jar
ant.jar
用于自动化调用程序完成项目的编译,打包,测试等
aopalliance-1.0.jar
支持Spring AOP
asm-2.2.3.jar
ASM字节码库
asm-commons-2.2.3.jar
ASM字节码库
asm-util-2.2.3.jar
Java字节码操纵和分析框架
aspectjrt.jar
处理事务和AOP所需的包
aspectjweaver.jar
处理事务和AOP所需的包
axiom-api-1.2.7.jar
Axis 对象模型
axiom-impl-1.2.7.jar
Axis 对象模型
bcprov-jdk15-140.jar
基于java1.5 的加密算法实现
bfmclientmodel.jar
使用WebSphere所需jar包
bpcclientcore.jar
使用WebSphere所需jar包
bpe137650.jar
提供远程访问BPE容器的实现。
bsh-2.0b4.jar
解决负载逻辑运算
c3p0-0.9.0.jar
开放源代码的JDBC连接池
cglib-nodep-2.1_3.jar
Spring中自动代理所需jar包
cobertura.jar
测量测试覆盖率
commons-beanutils-1.7.0.jar
动态的获取/设值Java Bean的属性
commons-chain-1.1.jar
实现责任链设计模式的Java 类库
commons-codec-1.3.jar
用来处理常用的编码方法的工具类包,例如DES、SHA1、MD5、Base64等等
commons-collections-3.1.jar
对标准java Collection的扩展
commons-collections.jar
对标准java Collection的扩展
commons-digester-1.8.jar
用于处理struts-config.xml配置文件
commons-fileupload-1.1.1.jar
struts上传文件
commons-httpclient-3.1.jar
用来简化HTTP客户端与服务器端进行各种通信编程实现
commons-io-1.1.jar
针对java.io.InputStream和Reader进行了扩展
commons-lang-2.4.jar
对java.lang.*的扩展
commons-logging-1.1.1.jar
日志包
commons-pool-1.3.jar
实现对象池化框架
commons-validator-1.3.1.jar
用来把验证规则程序提取出来,以供重复使用
db2jcc.jar
java连接DB2所需jar
db2jcc_license_cu.jar
java连接DB2所需jar
dom4j-1.6.1.jar
解析XML
ehcache-1.2.4.jar
hibernate的二级缓存如果用ehcache的时候需要此jar包
emf.jar
基于Eclipse的模型框架
ezmorph-1.0.6.jar
使用JSON所需的jar包
FastInfoset-1.2.2.jar
使用WebService所需的jar包
freemarker-2.3.8.jar
Strus2支持的一种表现层框架
geronimo-activation_1.1_spec-1.0.2.jar
Apache Geronimo所带jar包,
geronimo-annotation_1.0_spec-1.1.1.jar
Apache Geronimo所带jar包
geronimo-javamail_1.4_spec-1.3.jar
Apache Geronimo所带jar包
geronimo-jaxws_2.1_spec-1.0.jar
Apache Geronimo所带jar包
geronimo-jms_1.1_spec-1.1.1.jar
Apache Geronimo所带jar包
geronimo-servlet_2.5_spec-1.2.jar
Apache Geronimo所带jar包
geronimo-stax-api_1.0_spec-1.0.1.jar
Apache Geronimo所带jar包
hibernate3.jar
Hibernate3的核心jar包
htmclientmodel.jar
使用WebSphere所需jar包
jakarta-oro.jar
一套文本处理工具,提供per15.0兼容的表达式,AWK-like表达式,Glob表达式。
javassist.jar
Javassist 字节码解释器
jaxb-api-2.1.jar
使用WebService所需的jar包
jaxb-impl-2.1.7.jar
使用CXF所需jar包
jaxb-xjc-2.1.7.jar
使用CXF所需jar包
jaxen-1.1.1.jar
解析XML
jcifs-1.2.22.jar
实现单点登陆
jdom2-1.0.jar
解析XML
jdom-1.0.jar
解析XML
jettison-1.0.1.jar
使用CXF所需jar包
jetty-6.1.9.jar
Jetty Http服务器jar
jetty-util-6.1.9.jar
Jetty Http服务器jar
jra-1.0-alpha-4.jar
使用CXF所需jar包
js-1.6R7.jar
使用CXF所需jar包
json-lib-2.2.3-jdk13.jar
使用JSON所需的jar包
jsonplugin-0.25.jar
strus2的JSON插件
jsr311-api-0.8.jar
使用CXF所需jar包
jstl.jar
JSTL标签库
jta.jar
标准的 JAVA 事务处理接口
junit.jar
用于单元测试
jxl.jar
通过java操作excel表格的工具类库
ldap.jar
JNDI目录服务和LDAO服务器所需的jar
ldapbp.jar
JNDI目录服务和LDAO服务器所需的jar
log4j-1.2.15.jar
提供日志功能
mail.jar
java发送邮件jar包
neethi-2.0.4.jar
使用CXF所需jar包
odmg-3.0.jar
ODMG是一个ORM的规范,Hibernate实现了ODMG规范,这是一个核心的库
ognl-2.6.11.jar
struts2中OGNL语言
ojdbc14.jar
Oracle数据库驱动包
opensaml-1.1.jar
使用CXF所需jar包
oro-2.0.8.jar
Validator框架所需的jar包
oscache-2.1.jar
Java 对象的缓存工具
poi-3.1-FINAL-20080629.jar
操作exce所需jar包
poi-contrib-3.1-FINAL-20080629.jar
操作exce所需jar包
poi-ooxml-3.6-20091214.jar
提供对office的word、excel、visio及ppt的操作
poi-ooxml-schemas-3.6-20091214.jar
提供对office的word、excel、visio及ppt的操作
poi-scratchpad-3.1-FINAL-20080629.jar
提供对office的word、excel、visio及ppt的操作
processCommon.jar
IBM WebSphere 运行所需jar
ProcessCommonLibrary.jar
IBM WebSphere 运行所需jar
processIdentity.jar
IBM WebSphere 运行所需jar
ProcessInformation.jar
进程监视软件包
proxool-0.9.1.jar
数据库连接池
proxool-cglib.jar
数据库连接池
quartz-1.6.0.jar
开源作业调度框架
saaj-api-1.3.jar
使用axis所需的jar
saaj-impl-1.3.2.jar
使用axis所需的jar
serializer-2.7.1.jar
XML序列化
slf4j-jdk14-1.5.6.jar
整合各种日志框架的工具
spring208.jar
spring核心框架
spring-ldap-1.2-RC1.jar
spring下LDAP
spring-mock.jar
spring的测试框架
standard.jar
使用JSTL标签库所需的jar
stax-api-1.0.1.jar
解析XML
struts2-core-2.0.14.jar
struts2核心jar
struts2-spring-plugin-2.0.6.jar
struts2整合Spring所需jar
taglibs-datetime.jar
Apache开源组织提供标签库,用于格式化日期。
taglibs-mailer.jar
用于发送邮件
taglibs-string.jar
Apache开源组织提供标签库,用于对String的操作。
task137650.jar
Portal技术在SOA系统集成应用中实现所需的jar
utility.jar
Apache开源组织提供标签库
velocity-1.5.jar
一个免费的开源模板框架
wsdl4j-1.6.2.jar
用来解析服务的WSDl文件
wss4j-1.5.4.jar
创建CXF所需jar
wstx-asl-3.2.6.jar
创建CXF所需jar
xbean-spring-2.8.jar
使用xfire所需jar
xerces-2.6.2.jar
XML解析器
xfire-all-1.2.6.jar
用于实现WebService
XmlSchema-1.1.jar
使用xfire所需jar
xwork-2.0.7.jar
WebWork核心jar
很详细 :idea:
一个中国移动的系统,呵呵,报错来的,现在调试好了 :lol: