diff --git a/spring-mvc-xml/src/main/java/org/baeldung/spring/ClientWebConfig.java b/spring-mvc-xml/src/main/java/org/baeldung/spring/ClientWebConfig.java index eaefb0984b..c4d819caa5 100644 --- a/spring-mvc-xml/src/main/java/org/baeldung/spring/ClientWebConfig.java +++ b/spring-mvc-xml/src/main/java/org/baeldung/spring/ClientWebConfig.java @@ -1,15 +1,10 @@ package org.baeldung.spring; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.ViewResolver; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.context.annotation.ImportResource; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -import org.springframework.web.servlet.view.InternalResourceViewResolver; -import org.springframework.web.servlet.view.JstlView; -@EnableWebMvc +@ImportResource("classpath:webMvcConfig.xml") @Configuration public class ClientWebConfig extends WebMvcConfigurerAdapter { @@ -19,21 +14,4 @@ public class ClientWebConfig extends WebMvcConfigurerAdapter { // API - @Override - public void addViewControllers(final ViewControllerRegistry registry) { - super.addViewControllers(registry); - - registry.addViewController("/sample.html"); - } - - @Bean - public ViewResolver viewResolver() { - final InternalResourceViewResolver bean = new InternalResourceViewResolver(); - - bean.setViewClass(JstlView.class); - bean.setPrefix("/WEB-INF/view/"); - bean.setSuffix(".jsp"); - - return bean; - } } \ No newline at end of file diff --git a/spring-mvc-xml/src/main/java/org/baeldung/spring/ClientWebConfigOld.java b/spring-mvc-xml/src/main/java/org/baeldung/spring/ClientWebConfigOld.java new file mode 100644 index 0000000000..d621a00106 --- /dev/null +++ b/spring-mvc-xml/src/main/java/org/baeldung/spring/ClientWebConfigOld.java @@ -0,0 +1,37 @@ +package org.baeldung.spring; + +import org.springframework.context.annotation.Bean; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.view.InternalResourceViewResolver; +import org.springframework.web.servlet.view.JstlView; + +//@EnableWebMvc +//@Configuration +public class ClientWebConfigOld extends WebMvcConfigurerAdapter { + + public ClientWebConfigOld() { + super(); + } + + // API + + @Override + public void addViewControllers(final ViewControllerRegistry registry) { + super.addViewControllers(registry); + + registry.addViewController("/sample.html"); + } + + @Bean + public ViewResolver viewResolver() { + final InternalResourceViewResolver bean = new InternalResourceViewResolver(); + + bean.setViewClass(JstlView.class); + bean.setPrefix("/WEB-INF/view/"); + bean.setSuffix(".jsp"); + + return bean; + } +} \ No newline at end of file diff --git a/spring-mvc-xml/src/main/resources/webMvcConfig.xml b/spring-mvc-xml/src/main/resources/webMvcConfig.xml new file mode 100644 index 0000000000..2a9cccdbe4 --- /dev/null +++ b/spring-mvc-xml/src/main/resources/webMvcConfig.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/spring-mvc-xml/src/main/resources/webSecurityConfig.xml b/spring-mvc-xml/src/main/resources/webSecurityConfig.xml deleted file mode 100644 index 35dcb9c1ef..0000000000 --- a/spring-mvc-xml/src/main/resources/webSecurityConfig.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file