pom.xml
주의: 6.X 까지만 지원, 7.X 버젼까지 사용하려면 spring-boot-starter-validation 을 적용해야 함
<!-- 하이버네이트 발리데이터 라이브러리 추가 -->
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.2.3.Final</version>
</dependency>
root-context.xml
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:/META-INF/messages"></property>
</bean>
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="validationMessageSource" ref="messageSource"></property>
</bean>
servlet-context.xml
<annotation-driven validator="validator" />
사용
Controller에
@Valid
hidden method filter (0) | 2022.05.25 |
---|---|
Security AJAX (2) | 2022.05.23 |
이메일 (4) | 2022.05.13 |
Transaction (4) | 2022.05.12 |
SQL로그 남기기(log4jdbc-log4j2) (4) | 2022.05.10 |