<?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"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.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"><!--项目部署路径D:\workspaces\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps使用数据源和指定persistence.xml位置的方式创建entityManagerFactory,如果使用的不是hibernateJPA实现, 需要在tomcat作一些特殊配置.具体参考手册注意:使用该方式需要把persistence.xml中的hibernate.connection.driver_class,hibernate.connection.username,hibernate.connection.password,hibernate.connection.url配置删除--><!-- 属性编辑器 --><context:property-placeholder location="classpath:jdbc.properties" /><!-- 自动扫描类上的注解 --><context:component-scan base-package="com.schoolcloud" /><!-- 配置数据源 --><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"destroy-method="close"><property name="driverClass" value="${driverClass}" /><property name="jdbcUrl" value="${jdbcUrl}" /><property name="user" value="${user}" /><property name="password" value="${password}" /><!-- 初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。Default: 3 --><property name="initialPoolSize" value="${initialPoolSize}" /><!-- 连接池中保留的最小连接数。 --><property name="minPoolSize" value="${minPoolSize}" /><!-- 连接池中保留的最大连接数。Default: 15 --><property name="maxPoolSize" value="${maxPoolSize}" /><!-- 最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 --><property name="maxIdleTime" value="${maxIdleTime}" /><!-- 当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 --><property name="acquireIncrement" value="${acquireIncrement}" /><!-- 每60秒检查所有连接池中的空闲连接。Default: 0 --><property name="idleConnectionTestPeriod" value="${idleConnectionTestPeriod}" /></bean><!--配置工厂,这个EntityManagerFactory由spring来去提供,作用类似于hibernate中的SessionFactory--><bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"><property name="dataSource" ref="dataSource" /><property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" /><property name="loadTimeWeaver"><bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" /></property></bean><!-- 建立视图内拦截器来解决JPA中访问延迟加载属性时产生的无会话异常 --><!-- LazyInitializationException: could not initialize proxy no session --><!-- 此拦截器会注入到servlet配置中的DefaultAnnotationHandlerMapping中 --><!-- <bean name="openEntityManagerInViewInterceptor" class="org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor"><property name="entityManagerFactory"><ref bean="entityManagerFactory" /></property></bean> --><!-- 配置JPA事务管理器 --><bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"><property name="entityManagerFactory" ref="entityManagerFactory" /></bean><tx:annotation-driven transaction-manager="transactionManager" /></beans>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。