applicationContext.xml
来源:互联网 发布:java定义整形变量关键 编辑:程序博客网 时间:2024/06/05 12:41
<?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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">
<!-- 引入外部属性文件 -->
<context:property-placeholder location="classpath:jdbc.properties"/>
<!-- 配置C3P0连接池: -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${jdbc.driver}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.user}"/>
<property name="password" value="${jdbc.password}"/>
<!-- 每20秒检查所有连接池中的空闲连接 -->
<property name="idleConnectionTestPeriod" value="3"></property>
<!-- 最大空闲时间,30秒内未使用则连接被丢弃。若为0则永不丢弃 -->
<property name="maxIdleTime" value="5"></property>
<!-- 最大连接数 -->
<property name="maxPoolSize" value="20"></property>
</bean>
<!-- Hibernate的相关信息 -->
-->
<bean id="mySessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<!-- 不采用数据库连接池C3P0,纯手动获取连接(连接不会释放)
<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
-->
<!-- 注入连接池(1、提前获取连接 2、维护好hibernate给丢弃的连接) -->
<property name="dataSource" ref="dataSource"/>
<!-- 配置Hibernate的其他的属性 -->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.connection.autocommit">false</prop>
<!-- 开机自动生成表 -->
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>Bean/product.hbm.xml</value>
</list>
</property>
</bean>
<bean id="indexAction" class="Action.ItemsAction" scope="prototype">
<property name="ser" ref="myIndexService"></property>
</bean>
<bean id="myIndexService" class="Service.Service" scope="prototype">
<property name="dao" ref="myIndexDao"></property>
</bean>
<bean id="myIndexDao" class="Dao.Dao" scope="prototype">
<property name="sessionfactory" ref="mySessionFactory"></property>
</bean>
</beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">
<!-- 引入外部属性文件 -->
<context:property-placeholder location="classpath:jdbc.properties"/>
<!-- 配置C3P0连接池: -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${jdbc.driver}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.user}"/>
<property name="password" value="${jdbc.password}"/>
<!-- 每20秒检查所有连接池中的空闲连接 -->
<property name="idleConnectionTestPeriod" value="3"></property>
<!-- 最大空闲时间,30秒内未使用则连接被丢弃。若为0则永不丢弃 -->
<property name="maxIdleTime" value="5"></property>
<!-- 最大连接数 -->
<property name="maxPoolSize" value="20"></property>
</bean>
<!-- Hibernate的相关信息 -->
<!--
默认情况下,从bean工厂所取得的实例为Singleton(单例)
-->
<bean id="mySessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<!-- 不采用数据库连接池C3P0,纯手动获取连接(连接不会释放)
<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
-->
<!-- 注入连接池(1、提前获取连接 2、维护好hibernate给丢弃的连接) -->
<property name="dataSource" ref="dataSource"/>
<!-- 配置Hibernate的其他的属性 -->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.connection.autocommit">false</prop>
<!-- 开机自动生成表 -->
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>Bean/product.hbm.xml</value>
</list>
</property>
</bean>
<bean id="indexAction" class="Action.ItemsAction" scope="prototype">
<property name="ser" ref="myIndexService"></property>
</bean>
<bean id="myIndexService" class="Service.Service" scope="prototype">
<property name="dao" ref="myIndexDao"></property>
</bean>
<bean id="myIndexDao" class="Dao.Dao" scope="prototype">
<property name="sessionfactory" ref="mySessionFactory"></property>
</bean>
</beans>
0 0
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- ApplicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- applicationContext.xml
- swiftUI基础 使用storyboard建立UITableView
- 每日命令:过滤命令cut、sort、uniq、wc、tee、head、tail、grep、
- 中间件通俗理解
- Mac/windows Intellij IDEA 15 JRebel6.4.5 破解
- AndroidStudio使用*.9.png
- applicationContext.xml
- oracle笔记1-FUNCTION 函数
- FreeMarker内建函数
- mjrefresh自动判断是否隐藏mj_footer
- Regular Expression Matching
- atoi()
- 学习maven的使用,看到一篇很实用的入门教程(菜鸟级入门)
- 牛客网刷题笔记--左右最值最大差
- Android View的onTouchEvent和OnTouch区别