From 3a6206c66614ec02fd5aa0196f0693f63208d55c Mon Sep 17 00:00:00 2001 From: prashant1067 Date: Tue, 2 Aug 2016 11:51:30 +0530 Subject: [PATCH] Update StudentControllerConfig.java (#569) Making formatting changes --- .../config/StudentControllerConfig.java | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/spring-all/src/main/java/org/baeldung/controller/config/StudentControllerConfig.java b/spring-all/src/main/java/org/baeldung/controller/config/StudentControllerConfig.java index 2ae28b6b4a..443635fb70 100644 --- a/spring-all/src/main/java/org/baeldung/controller/config/StudentControllerConfig.java +++ b/spring-all/src/main/java/org/baeldung/controller/config/StudentControllerConfig.java @@ -11,27 +11,21 @@ import org.springframework.web.context.support.GenericWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; public class StudentControllerConfig implements WebApplicationInitializer { + + @Override + public void onStartup(ServletContext sc) throws ServletException { + AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); + root.register(WebConfig.class); + root.setServletContext(sc); - @Override - public void onStartup(ServletContext sc) throws ServletException { - AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); - root.register(WebConfig.class); - - root.refresh(); - root.setServletContext(sc); - - // Manages the lifecycle of the root application context - sc.addListener(new ContextLoaderListener(root)); - - - - DispatcherServlet dv =new DispatcherServlet(new GenericWebApplicationContext()); - - ServletRegistration.Dynamic appServlet = sc.addServlet("test-mvc",dv ); - appServlet.setLoadOnStartup(1); - appServlet.addMapping("/test/*"); - } + // Manages the lifecycle of the root application context + sc.addListener(new ContextLoaderListener(root)); + DispatcherServlet dv = new DispatcherServlet(new GenericWebApplicationContext()); + + ServletRegistration.Dynamic appServlet = sc.addServlet("test-mvc", dv); + appServlet.setLoadOnStartup(1); + appServlet.addMapping("/test/*"); } - +}