applicationContext.xml配置数据源,事务管理器,sessionFactory

<bean id="datasource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"/>
    
    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
       <property name="dataSource" ref="datasource"/>
           <property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
       
    </bean>
    <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager" >
        <property name="sessionFactory"><ref bean="sessionFactory" /></property>
    </bean>
    <tx:annotation-driven transaction-manager="transactionManager"/>
    
    <bean id="userDao" class="com.study.dao.UserDao" >
        <property name="sessionFactory"><ref bean="sessionFactory" /></property>
    </bean>
    <context:component-scan base-package="com.study.*"></context:component-scan>
    <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>

applicationContext.xml配置数据源,事务管理器,sessionFactory

上一篇:ARM发了一款支持5G的新处理器,预计年内面世


下一篇:修改Android Studio默认配置文件路径