主要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" 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-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /> <property name="url" value="jdbc:oracle:thin:@10.60.2.199:1521:ufida" /> <property name="username" value="finance" /> <property name="password" value="finance" /> </bean> <!-- SqlMap setup for iBATIS Database Layer --> <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation" value="WEB-INF/sqlmap-config.xml" /> <property name="dataSource" ref="dataSource" /> </bean> <!-- 事务配置 Start--> <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="get*" read-only="true" /> <tx:method name="*" /> </tx:attributes> </tx:advice> <aop:config proxy-target-class="true"> <aop:advisor pointcut="execution(* com.yourcompany.service.*.*(..))" advice-ref="txAdvice" /> </aop:config> <!-- 事务配置 End--> <!-- ========================= DAO DEFINITIONS: IBATIS ========================= --> <bean id="ufAccountDAO" class="com.yourcompany.dao.UfAccountDAO"> <property name="sqlMapClient" ref="sqlMapClient" /> </bean> <bean id="accountService" class="com.yourcompany.service.AccountService"> <property name="ufAccountDAO" ref="ufAccountDAO" /> </bean> <bean name="/ufAccount" class="com.yourcompany.struts.action.UfAccountAction"> <property name="accountService"> <ref bean="accountService" /> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="mappingJarLocations"> <list> <value>WEB-INF/lib/jbpm-3.1.4.jar</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> <prop key="hibernate.show_sql">false</prop> </props> </property> </bean> <bean id="jbpmConfiguration" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean"> <property name="sessionFactory" ref="sessionFactory" /> <property name="configuration" value="classpath:org/jbpm/default.jbpm.cfg.xml" /> <property name="createSchema" value="false" /> 为ture则在启动时数据库生成jbpm相关的表 </bean> </beans>
<property name="configuration" value="classpath:org/jbpm/default.jbpm.cfg.xml" />
这人引入的是jbpm-3.1.4.jar文件中,中间有一段
<string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml" />
它要到src下找到hibernate.cfg.xml文件 可以在项目中src下加上一个hibernate的配置文件,否则它会到jbpm.sar.cfg.jar文件找,打开jbpm.sar.cfg.jar文件可以看到有一个hibernate.cfg.xml文件,可以改它,它有个datasource的配置项,不用管加上连接DB的相关配置,以下是我的配置
<property name="hibernate.dialect"> org.hibernate.dialect.OracleDialect </property> <property name="hibernate.connection.driver_class"> oracle.jdbc.driver.OracleDriver </property> <property name="hibernate.connection.url"> jdbc:oracle:thin:@10.60.2.199:1521:ufida </property> <property name="hibernate.connection.username">finance</property> <property name="hibernate.connection.password">finance</property> <property name="connection.pool.size">3</property> <property name="show_sql">true</property> <property name="hibernate.cache.provider_class"> org.hibernate.cache.HashtableCacheProvider </property> <property name="hibernate.show_sql">true</property>
当然这个文件下面还有许多mapping的配置,不用改它.
ok.搞定.在此B视下现在的工作公司,不让上网,工作效率太低