NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

<!-- 数据源连接信息配置文件 -->
<import resource="classpath:config/applicationContext-datasource.xml"/>

<!-- spring 集成 mybatis 开始 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource_div" />
<property name="configLocation" value="classpath:config/mybatis.xml" />
<property name="mapperLocations" value="classpath:com/ge/mapper/**/*.xml" />
<property name="typeAliasesPackage" value="com.ge.entity"/><!-- 也配配置在mybatis主配置文件中 -->
<!-- mybatis拦截器,用于map自定义组成,也可配置在mybatis.xml中-->
<!--
<property name="plugins">
<list>
<bean class="com.ge.intercepts.mybatis.mapInterceptor.MapInterceptor"/>
</list>
</property>
-->
</bean>

<!-- 第二数据源 -->
<bean id="sqlSessionFactory_log" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource_log" />
<property name="configLocation" value="classpath:config/mybatis.xml" />
<property name="mapperLocations" value="classpath:com/ge/mapp/**/*.xml" /> <!-- mapp夹下 -->
<property name="typeAliasesPackage" value="com.ge.entity"/>
</bean>

<!-- spring 集成 mybatis 结束 -->

<!-- 事务配置 开始 -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource_div" />
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager"><!-- 事务加载规则配置 -->
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="updPhonechargeByBatch" propagation="NEVER" /> <!-- com.ge.service.play.phonecharge.IPhonechargeService.updPhonechargeByBatch -->
<tx:method name="upd*" propagation="REQUIRED" />
<tx:method name="set*" propagation="REQUIRED" />
<tx:method name="ws*" propagation="REQUIRED" />
<tx:method name="import*" propagation="REQUIRED" />
<tx:method name="refresh*" propagation="REQUIRED" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>

<!-- 日志表事务 -->
<bean id="transactionManager_log"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource_log" />
</bean>
<tx:advice id="txAdvice_log" transaction-manager="transactionManager_log">
<tx:attributes>
<tx:method name="*" read-only="true" /> <!-- 只有查询操作 -->
</tx:attributes>
</tx:advice>

<!-- 事务配置 结束 -->

<!-- 日志配置 -->
<bean id="aopLogAspectInterceptor" class="com.ge.interceptor.spring.AopLogAspect" />

<!-- AOP 配置(advisor 事务,aspect 日志) -->
<aop:config proxy-target-class="true"> <!-- spring 事务加载aop配置 -->
<aop:advisor pointcut="execution(* *..*Service.*(..))" advice-ref="txAdvice" />

<aop:aspect id="aopLogAspect" ref="aopLogAspectInterceptor">
<aop:pointcut id="businessService" expression="execution(* *..*Service.*(..))" />
<aop:before pointcut-ref="businessService" method="doBefore"/>
<aop:after pointcut-ref="businessService" method="doAfter"/>
<aop:around pointcut-ref="businessService" method="doAround"/>
<aop:after-throwing pointcut-ref="businessService" method="doThrowing" throwing="ex"/>
</aop:aspect>
</aop:config>


<!-- 缓存配置 开始 -->
<!--
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="/WEB-INF/ehcache.xml"/>
</bean>
<bean id="cacheProviderFacade" class="org.springmodules.cache.provider.ehcache.EhCacheFacade">
<property name="cacheManager" ref="cacheManager" />
</bean>
-->
<!-- 缓存配置 结束 -->

<!-- action+service自动装配 开始 -->
<!-- 对包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能 -->
<!-- 因为spring配置文件加载顺序为spring.xml 然后为spring-mvc.xml,如果此处进行Controller注入那么会将没有进行事务处理的对象注入到Controller
所以此处只进行org.springframework.stereotype.Service即@service注入,mybatis由下方org.mybatis.spring.mapper.MapperScannerConfigurer进行扫描
-->
<context:component-scan base-package="com.ge" use-default-filters="false">
<!-- 允许定义过滤器将基包下的某些类纳入或排除-->
<!-- <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/> -->
<!-- <context:include-filter type="regex" expression="com.ge.controller.*"/> -->
<!-- <context:include-filter type="regex" expression="com.ge.service.*"/> -->
<context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
</context:component-scan>
<!-- action+service自动装配 结束 -->

<!-- mybatis 自动装配开始 -->
<!-- 单个的注册 MapperFactoryBean 数据映射器类 mapper bean -->
<!--
<bean id="demoMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
<property name="mapperInterface" value="com.ge.mapper.demo.DemoMapper" />
</bean>
-->
<!--
利用MyBatis-Spring的自动装配机制:
自动从 com.ge.mapper 包中寻找接口装配成MapperFactoryBean
有了下面这个配置,那么就不需要像上面那样一个一个的去注册映射器Bean了,大大的减少了工作量
-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.ge.mapper" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />

<!--此方法与上方法作用相同,但是由于spring与mybatis结合才有扫描机制时,会提前加载sqlSessionFactory,而此时${}还未被加载,导致加载出错
采用sqlSessionFactoryBeanName方法可有效延迟加载sqlSessionFactory,且作用于下方相同
-->
<!-- <property name="sqlSessionFactory" ref="sqlSessionFactory" /> -->
</bean>

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.ge.mapp" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory_log" />
</bean>

<!-- mybatis 自动装配结束 -->

<aop:aspectj-autoproxy proxy-target-class="true"/><!-- aop注解支持 -->

<bean id="staticMapInit" class="com.ge.common.StaticMapInit"></bean>
<import resource="classpath:config/applicationContext-quartz.xml"/>
</beans>
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.