57 lines
2.4 KiB
XML
57 lines
2.4 KiB
XML
<?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:aop="http://www.springframework.org/schema/aop"
|
||
xsi:schemaLocation="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.xsd
|
||
http://www.springframework.org/schema/tx
|
||
http://www.springframework.org/schema/tx/spring-tx.xsd
|
||
http://www.springframework.org/schema/aop
|
||
http://www.springframework.org/schema/aop/spring-aop.xsd">
|
||
|
||
<!-- 加载属性文件 -->
|
||
<context:property-placeholder location="classpath:application.properties"/>
|
||
|
||
<!-- 配置ObjectMapper -->
|
||
<bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper" primary="true">
|
||
<property name="dateFormat">
|
||
<bean class="java.text.SimpleDateFormat">
|
||
<constructor-arg value="yyyy-MM-dd HH:mm:ss"/>
|
||
</bean>
|
||
</property>
|
||
<!-- 配置JSON序列化特性 -->
|
||
<property name="serializationInclusion">
|
||
<value type="com.fasterxml.jackson.annotation.JsonInclude.Include">NON_NULL</value>
|
||
</property>
|
||
</bean>
|
||
|
||
<!-- 开启注解扫描,排除Controller -->
|
||
<context:component-scan base-package="ltd.qubit.survey">
|
||
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
||
</context:component-scan>
|
||
|
||
<!-- 配置事务注解驱动 -->
|
||
<tx:annotation-driven/>
|
||
|
||
<!-- 配置事务通知 -->
|
||
<tx:advice id="txAdvice" transaction-manager="transactionManager">
|
||
<tx:attributes>
|
||
<tx:method name="get*" read-only="true"/>
|
||
<tx:method name="find*" read-only="true"/>
|
||
<tx:method name="list*" read-only="true"/>
|
||
<tx:method name="query*" read-only="true"/>
|
||
<tx:method name="*" propagation="REQUIRED"/>
|
||
</tx:attributes>
|
||
</tx:advice>
|
||
|
||
<!-- 配置事务切面 -->
|
||
<aop:config>
|
||
<aop:pointcut id="txPointcut" expression="execution(* ltd.qubit.survey.service..*.*(..))"/>
|
||
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/>
|
||
</aop:config>
|
||
|
||
</beans> |