|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <?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:tx="http://www.springframework.org/schema/tx"
- xmlns:mybatis-spring="http://mybatis.org/schema/mybatis-spring"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xsi:schemaLocation="http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring-1.2.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-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/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
-
- <aop:config proxy-target-class="true"/>
- <context:annotation-config/>
- <!--<task:annotation-driven executor="permissionUpdateExecutor"/>-->
-
-
- <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <list>
- <value>classpath:application.properties</value>
- </list>
- </property>
- </bean>
- <bean id="dataSource" destroy-method="close" class="com.sie.iot.common.dbcp.BasicDataSourceDecrypt">
- <property name="driverClassName" value="${properties.jdbc.driverClassName}"/>
- <property name="url" value="${properties.jdbc.url}"/>
- <property name="username" value="${properties.jdbc.username}"/>
- <property name="password" value="${properties.jdbc.password}"/>
- <property name="validationQuery" value="${properties.jdbc.validationQuery}"/>
- <property name="initialSize" value="${properties.jdbc.initialSize}"/>
- <property name="maxActive" value="${properties.jdbc.maxActive}"/>
- <property name="maxIdle" value="${properties.jdbc.maxIdle}"/>
- <property name="minIdle" value="${properties.jdbc.minIdle}"/>
- </bean>
-
- <!-- 事务管理器 -->
- <bean id="dataSourceTransactionManager"
- class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="dataSource"></property>
- </bean>
- <!-- 基于注解的事务管理 -->
- <tx:annotation-driven transaction-manager="dataSourceTransactionManager"/>
-
- <!--配置sqlSessionTemplate:通过带参数的构造方法创建对象 -->
- <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
- <!-- 以sqlSessionFactory为参数传入构造函数中 -->
- <constructor-arg ref="sqlSessionFactoryBean"/>
- <!-- mybatis执行器,取值范围是SIMPLE/REUSE/BATCH三种类型 -->
-
- <constructor-arg value="BATCH"/>
- </bean>
- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="dataSource"></property>
- </bean>
- <!-- 配置SqlSessionFactoryBean
- Mybatis提供的: org.mybatis.spring.SqlSessionFactoryBean
- MP提供的:com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean
- -->
- <bean id="sqlSessionFactoryBean" class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean">
- <!-- 数据源 -->
- <property name="dataSource" ref="dataSource"></property>
- <property name="configLocation" value="classpath:com/yuexiu/secp/comm/config/mybatis-config.xml"></property>
- <!-- 别名处理 -->
- <!-- <property name="typeAliasesPackage" value="com.atguigu.mp.beans"></property>-->
- <!-- 注入全局MP策略配置 -->
- <property name="globalConfig" ref="globalConfiguration"></property>
-
- <!-- 插件注册 -->
- <property name="plugins">
- <list>
- <!-- 注册分页插件 -->
- <!--<bean class="com.baomidou.mybatisplus.plugins.PaginationInterceptor"></bean>-->
- <bean class="com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor"></bean>
-
-
- <!-- 注册执行分析插件 -->
- <bean class="com.baomidou.mybatisplus.extension.plugins.SqlExplainInterceptor">
- <!--<property name="stopProceed" value="true"></property>-->
- </bean>
-
- <!-- 注册性能分析插件 -->
- <!-- <bean class="com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor">
- <property name="format" value="true"></property>
- <!– <property name="maxTime" value="5"></property> –>
- </bean>-->
-
- <!-- 注册乐观锁插件 -->
- <bean class="com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor">
- </bean>
-
- </list>
-
- </property>
-
- </bean>
-
- <!-- 定义MybatisPlus的全局策略配置-->
- <!--<bean id ="globalConfiguration" class="com.baomidou.mybatisplus.entity.GlobalConfiguration">-->
- <bean id="globalConfiguration" class="com.baomidou.mybatisplus.core.config.GlobalConfig">
-
- <!-- 在2.3版本以后,dbColumnUnderline 默认值就是true -->
- <!--<property name="dbColumnUnderline" value="true"></property>-->
-
- <!-- 全局的主键策略 -->
- <!--<property name="idType" value="0"></property>-->
-
- <!-- 全局的表前缀策略配置 -->
- <!--<property name="tablePrefix" value="tbl_"></property>-->
-
- <!--自定义填充策略接口实现-->
- <property name="metaObjectHandler" ref="myMetaObjectHandler"/>
-
- <property name="identifierGenerator" ref="customIdGenerator"/>
-
- </bean>
-
- <!-- 公共字段填充 处理器 -->
- <bean id="myMetaObjectHandler" class="com.siefw.hibernate.core.handler.ModelMetaObjectHandler"></bean>
- <bean name="customIdGenerator" class="com.sie.iot.common.idgenerate.CustomerIdGenerator"/>
- <!--
- 配置mybatis 扫描mapper接口的路径
- -->
- <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage"
- value="com.sie.demo.comm.model.dao,com.sie.iot.base.model.dao"></property>
- </bean>
-
- <!-- 配置事务的传播特性 -->
- <tx:advice id="txAdvice" transaction-manager="dataSourceTransactionManager">
- <tx:attributes>
- <tx:method name="insert*" propagation="REQUIRED" rollback-for="Exception"/>
- <tx:method name="save*" propagation="REQUIRED" rollback-for="Exception"/>
- <tx:method name="update*" propagation="REQUIRED" rollback-for="Exception"/>
- <tx:method name="delete*" propagation="REQUIRED" rollback-for="Exception"/>
- <tx:method name="remove*" propagation="REQUIRED" rollback-for="Exception"/>
- <tx:method name="relesae*" propagation="REQUIRED" rollback-for="Exception" read-only="false"/>
- <tx:method name="send*" propagation="REQUIRED" rollback-for="Exception" read-only="false"/>
- <tx:method name="set*" propagation="REQUIRED" rollback-for="Exception" read-only="false"/>
- <tx:method name="find*" read-only="true"/>
- <tx:method name="get*" read-only="true"/>
- <tx:method name="*" read-only="true"/>
- </tx:attributes>
- </tx:advice>
-
-
- <!-- 那些类的哪些方法参与事务 -->
- <aop:config><!--|| execution(* com.sie.saaf.*.model.dao.readonly.*.*(..))-->
- <aop:pointcut id="businessService" expression="execution(* com.yuexiu.secp.comm.model.service.impl.*.*(..))
- || execution(* com.sie.iot.common.model.inter.server.*.*(..))
- || execution(* com.sie.iot.base.model.inter.server.*.*(..))"/>
- <aop:advisor advice-ref="txAdvice" pointcut-ref="businessService" order="0"/>
- </aop:config>
-
- <bean id="messageResource" class="org.springframework.context.support.ResourceBundleMessageSource">
- <property name="defaultEncoding" value="UTF-8"></property>
- <property name="cacheSeconds" value="0"></property>
- <property name="basenames">
- <list>
- <value>config.common</value>
- <value>config.2069-siedemo-comm-application</value>
- </list>
- </property>
- </bean>
- </beans>
|