diff --git a/spring-mvc/src/main/java/org/baeldung/spring/web/config/ClientWebConfig.java b/spring-mvc/src/main/java/org/baeldung/spring/web/config/ClientWebConfig.java deleted file mode 100644 index 2758a707e6..0000000000 --- a/spring-mvc/src/main/java/org/baeldung/spring/web/config/ClientWebConfig.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.baeldung.spring.web.config; - -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.web.servlet.config.annotation.WebMvcConfigurerAdapter; -import org.springframework.web.servlet.view.InternalResourceViewResolver; -import org.springframework.web.servlet.view.JstlView; - -@EnableWebMvc -@Configuration -public class ClientWebConfig extends WebMvcConfigurerAdapter { - - public ClientWebConfig() { - 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/src/main/java/org/baeldung/spring/web/config/MvcConfig.java b/spring-mvc/src/main/java/org/baeldung/spring/web/config/MvcConfig.java new file mode 100644 index 0000000000..093a785b48 --- /dev/null +++ b/spring-mvc/src/main/java/org/baeldung/spring/web/config/MvcConfig.java @@ -0,0 +1,16 @@ +package org.baeldung.spring.web.config; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; + +@EnableWebMvc +@Configuration +@ComponentScan({ "org.baeldung.spring.web.controller" }) +public class MvcConfig { + + public MvcConfig() { + super(); + } + +} \ No newline at end of file diff --git a/spring-mvc/src/main/java/org/baeldung/spring/web/controller/FooController.java b/spring-mvc/src/main/java/org/baeldung/spring/web/controller/FooController.java index ad03a4ac2f..a2628cbbbf 100644 --- a/spring-mvc/src/main/java/org/baeldung/spring/web/controller/FooController.java +++ b/spring-mvc/src/main/java/org/baeldung/spring/web/controller/FooController.java @@ -16,6 +16,6 @@ public class FooController { public String getFoos() { System.out.println("simplePattern method was called"); return "someResult"; - } + }