1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?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:p="http://www.springframework.org/schema/p"
- xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx.xsd
- http://www.springframework.org/schema/mvc
- http://www.springframework.org/schema/mvc/spring-mvc.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd">
- <mvc:annotation-driven validator="validator"></mvc:annotation-driven>
- <!-- hibernate validator参数校验 -->
- <bean id="validator"
- class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
- <property name="providerClass" value="org.hibernate.validator.HibernateValidator" />
- </bean>
- <!-- 方法级别的校验 要校验的方法所在类必须添加@Validated注解 -->
- <bean
- class="org.springframework.validation.beanvalidation.MethodValidationPostProcessor">
- <!-- 可以引用自己的 validator 配置,在本文中(下面)可以找到 validator 的参考配置,如果不指定则系统使用默认的 -->
- <property name="validator" ref="validator" />
- </bean>
- <context:component-scan base-package="com.fuzamei" />
- <!-- 配置事务 -->
- <bean id="transactionManager"
- class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <!-- 加载数据源 -->
- <property name="dataSource" ref="dataSource"></property>
- </bean>
- <!-- 开启事务扫描 -->
- <tx:annotation-driven transaction-manager="transactionManager"
- proxy-target-class="true" />
- <!-- 对token拦截验证 (为方便测试,测试环境给注释掉) -->
- <!-- <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/*/api/*" />
- <bean class="com.fuzamei.interceptor.TokenInterceptor" /> </mvc:interceptor>
- </mvc:interceptors> -->
- </beans>
|