forked from hacxer/codeFactory
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplicationContext-validator.xml
More file actions
33 lines (27 loc) · 1.77 KB
/
applicationContext-validator.xml
File metadata and controls
33 lines (27 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
default-autowire="byName" default-lazy-init="false">
<!-- 可以在国际化文件中使用如key: NotBlank.userInfo.username 或是@NotBlank(message="用户名不能为空") -->
<!-- 用于启用Hibernate Validator,并且使用spring MessageSource替换java ResourceBundle -->
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" >
<property name="messageInterpolator" ref="messageInterpolator"/>
</bean>
<bean id="messageInterpolator" class="org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator" >
<constructor-arg ref="resourceBundleLocator"></constructor-arg>
</bean>
<bean id="resourceBundleLocator" class="cn.org.rapid_framework.beanvalidation.MessageSourceResourceBundleLocator">
<property name="messageSource" ref="messageSource"/>
</bean>
<!-- 用于持有Validator,可以将Validator当做静态方法调用,示例:SpringValidatorHolder.validate(blogBean) -->
<!--
<bean class="cn.org.rapid_framework.util.holder.SpringValidatorHolder">
<property name="validator" ref="validator"/>
</bean>
-->
</beans>