| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <?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:util="http://www.springframework.org/schema/util"
- xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
- http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"
- default-autowire="byName" default-lazy-init="false">
- <!-- 自动扫描dao和service包(自动注入) -->
- <context:component-scan base-package="org.jeecgframework.easypoi.*" />
- <context:component-scan base-package="org.jeecgframework.core.common.dao.*" />
- <context:component-scan base-package="org.jeecgframework.core.common.service.*" />
- <context:component-scan base-package="cn.com.lzt.*"/>
- <context:component-scan base-package="com.xcgl.*"/>
- <context:component-scan base-package="com.jeecg.*">
- <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
- </context:component-scan>
- <!-- 加载service,此时要排除要controller,因为controller已经spring-mvc中加载过了 -->
- <context:component-scan base-package="org.jeecgframework.web.*">
- <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
- </context:component-scan>
- <!-- 引入属性文件 -->
- <context:property-placeholder location="classpath:dbconfig.properties,classpath:redis.properties,classpath:mq.properties" />
- <!-- 配置数据源1 -->
- <bean name="dataSource_jeecg" class="com.alibaba.druid.pool.DruidDataSource"
- init-method="init" destroy-method="close">
- <property name="url" value="${jdbc.url.jeecg}" />
- <property name="username" value="${jdbc.username.jeecg}" />
- <property name="password" value="${jdbc.password.jeecg}" />
- <!-- 初始化连接大小 -->
- <property name="initialSize" value="0" />
- <!-- 连接池最大使用连接数量 -->
- <property name="maxActive" value="20" />
- <!-- 连接池最大空闲
- <property name="maxIdle" value="20" />
- -->
- <!-- 连接池最小空闲 -->
- <property name="minIdle" value="5" />
- <!-- 获取连接最大等待时间 -->
- <property name="maxWait" value="60000" />
- <!--
- <property name="poolPreparedStatements" value="true" />
- <property name="maxPoolPreparedStatementPerConnectionSize" value="33" />
- -->
- <property name="validationQuery" value="${validationQuery.sqlserver}" />
- <property name="testOnBorrow" value="false" />
- <property name="testOnReturn" value="false" />
- <property name="testWhileIdle" value="true" />
- <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
- <property name="timeBetweenEvictionRunsMillis" value="60000" />
- <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
- <property name="minEvictableIdleTimeMillis" value="25200000" />
- <!-- 打开removeAbandoned功能 -->
- <property name="removeAbandoned" value="false" />
- <!-- 1800秒,也就是30分钟 -->
- <property name="removeAbandonedTimeout" value="3600" />
- <!-- 关闭abanded连接时输出错误日志 -->
- <property name="logAbandoned" value="true" />
- <!-- 开启Druid的监控统计功能 -->
- <property name="filters" value="stat" />
- <!--<property name="filters" value="mergeStat" /> -->
- <!-- Oracle连接是获取字段注释 -->
- <property name="connectProperties">
- <props>
- <prop key="remarksReporting">true</prop>
- </props>
- </property>
- </bean>
- <!-- 数据源集合 -->
- <bean id="dataSource"
- class="org.jeecgframework.core.extend.datasource.DynamicDataSource">
- <property name="targetDataSources">
- <map key-type="org.jeecgframework.core.extend.datasource.DataSourceType">
- <entry key="dataSource_jeecg" value-ref="dataSource_jeecg" />
- <!-- <entry key="mapdataSource" value-ref="mapdataSource" /> -->
- </map>
- </property>
- <property name="defaultTargetDataSource" ref="dataSource_jeecg" />
- </bean>
- <bean id="sessionFactory"
- class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
- <property name="dataSource" ref="dataSource" />
- <property name="entityInterceptor" ref="hiberAspect" />
- <property name="hibernateProperties">
- <props>
- <!--<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> -->
- <prop key="hibernate.dialect">${hibernate.dialect}</prop>
- <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
- <prop key="hibernate.show_sql">false</prop>
- <prop key="hibernate.format_sql">false</prop>
- <prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop>
- <prop key="hibernate.connection.release_mode">after_transaction</prop>
- </props>
- </property>
- <!-- 注解方式配置 -->
- <property name="packagesToScan">
- <list>
- <value>org.jeecgframework.web.system.pojo.*</value>
- <value>org.jeecgframework.web.test.entity.*</value>
- <value>org.jeecgframework.web.autoform.*</value>
- <value>org.jeecgframework.web.cgform.entity.*</value>
- <value>org.jeecgframework.web.cgreport.entity.*</value>
- <value>org.jeecgframework.web.cgdynamgraph.entity.*</value>
- <value>org.jeecgframework.web.graphreport.entity.*</value>
- <value>org.jeecgframework.web.system.sms.*</value>
- <value>com.jeecg.*</value>
- <value>jeecg.workflow.entity.*</value>
- <value>org.jeecgframework.workflow.*</value>
- <value>cn.com.lzt.*</value>
- <value>com.xcgl.*</value>
- </list>
- </property>
- </bean>
- <!-- JDBC配置 -->
- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="dataSource"/>
- </bean>
- <!-- JDBC配置 -->
- <bean id="namedParameterJdbcTemplate"
- class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
- <constructor-arg ref="dataSource" />
- </bean>
- <!-- 配置事物管理器,在*ServiceImpl里写@Transactional就可以启用事物管理 -->
- <!-- <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">-->
- <!-- <property name="dataSource" ref="dataSource" />-->
- <!-- <property name="nestedTransactionAllowed" value="true"/>-->
- <!-- </bean>-->
- <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactory"/>
- <property name="dataSource" ref="dataSource"/>
- </bean>
- <tx:annotation-driven transaction-manager="transactionManager" />
- <!-- JSR303 Validator定义 -->
- <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />
- </beans>
|