18

以下是我在其它论坛上发表的问题:

QUOTE:
我采用AbstractDependencyInjectionSpringContextTests进行测试,通过以下代码进行加载.
       protected String[] getConfigLocations() {                return new String[] { "classpath:springapplicationcontext.xml" };        }
以下是我原来的配置文件:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
       <bean id="dataSource"
               class="org.apache.commons.dbcp.BasicDataSource">
               <property name="driverClassName">
                       <value>oracle.jdbc.driver.OracleDriver</value>
字串1

               </property>
               <property name="url">
                       <value>jdbc:oracle:thin:@localhost:1521:oracle9</value>
               </property>
               <property name="username">
                       <value>gap</value>
               </property>
               <property name="password">
                       <value>gap</value>
               </property>
       </bean> 字串3
       <bean id="sessionFactory"
               class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
               <property name="dataSource" ref="dataSource" />
               <property name="configLocation">
                       <value>classpath:hibernate.cfg.xml</value>
               </property>
       </bean>
       <bean id="txManager"
               class="org.springframework.orm.hibernate3.HibernateTransactionManager">
               <property name="sessionFactory" ref="sessionFactory" /> 字串9
       </bean>
       <bean id="gapdictionaryDao" class="org.gap.dao.GapdictionaryDao">
               <property name="sessionFactory">
                       <ref bean="sessionFactory" />
               </property>
       </bean>
       <bean id="gap" class="org.gap.service.GapImpl">
               <property name="gapdictionaryDao" ref="gapdictionaryDao" />
       </bean>
</beans>

以下是我新的配置文件: 更多详细内容 »

Tags: ,

作者:Jock

Switch to our mobile site