diff --git a/spring-mvc-xml/pom.xml b/spring-mvc-xml/pom.xml index beea8e5ee2..46af321d1b 100644 --- a/spring-mvc-xml/pom.xml +++ b/spring-mvc-xml/pom.xml @@ -1,4 +1,5 @@ - 4.0.0 0.1-SNAPSHOT @@ -20,12 +21,6 @@ org.springframework spring-web ${org.springframework.version} - - - commons-logging - commons-logging - - org.springframework @@ -50,7 +45,7 @@ - org.hibernate + org.hibernate.validator hibernate-validator ${hibernate-validator.version} @@ -84,6 +79,11 @@ + + org.glassfish + javax.el + 3.0.1-b08 + org.springframework.boot diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfigJava.java b/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfigJava.java index 7925fa451d..09c34ccc80 100644 --- a/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfigJava.java +++ b/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfigJava.java @@ -5,8 +5,10 @@ import java.util.ResourceBundle; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.context.support.MessageSourceResourceBundle; import org.springframework.context.support.ResourceBundleMessageSource; +import org.springframework.validation.beanvalidation.MethodValidationPostProcessor; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -15,6 +17,7 @@ import org.springframework.web.servlet.view.JstlView; //@EnableWebMvc //@Configuration +@ComponentScan("com.baeldung.spring") public class ClientWebConfigJava implements WebMvcConfigurer { public ClientWebConfigJava() { @@ -51,4 +54,9 @@ public class ClientWebConfigJava implements WebMvcConfigurer { return bean; } + + @Bean + public MethodValidationPostProcessor methodValidationPostProcessor() { + return new MethodValidationPostProcessor(); + } } \ No newline at end of file diff --git a/spring-mvc-xml/src/test/java/com/baeldung/spring/controller/RequestAndPathVariableValidationControllerIntegrationTest.java b/spring-mvc-xml/src/test/java/com/baeldung/spring/controller/RequestAndPathVariableValidationControllerIntegrationTest.java index 318a15d8f7..c4332dd879 100644 --- a/spring-mvc-xml/src/test/java/com/baeldung/spring/controller/RequestAndPathVariableValidationControllerIntegrationTest.java +++ b/spring-mvc-xml/src/test/java/com/baeldung/spring/controller/RequestAndPathVariableValidationControllerIntegrationTest.java @@ -12,12 +12,13 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import com.baeldung.spring.ClientWebConfig; +import com.baeldung.spring.ClientWebConfigJava; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = ClientWebConfig.class) +@ContextConfiguration(classes = ClientWebConfigJava.class) @WebAppConfiguration public class RequestAndPathVariableValidationControllerIntegrationTest {