Skip to content

Commit 3a6206c

Browse files
prashant1067pivovarit
authored andcommitted
Update StudentControllerConfig.java (eugenp#569)
Making formatting changes
1 parent 797db0f commit 3a6206c

1 file changed

Lines changed: 14 additions & 20 deletions

File tree

‎spring-all/src/main/java/org/baeldung/controller/config/StudentControllerConfig.java‎

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,21 @@
1111
import org.springframework.web.servlet.DispatcherServlet;
1212

1313
public class StudentControllerConfig implements WebApplicationInitializer {
14+
15+
@Override
16+
public void onStartup(ServletContext sc) throws ServletException {
17+
AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
18+
root.register(WebConfig.class);
1419

20+
root.setServletContext(sc);
1521

16-
@Override
17-
public void onStartup(ServletContext sc) throws ServletException {
18-
AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
19-
root.register(WebConfig.class);
20-
21-
root.refresh();
22-
root.setServletContext(sc);
23-
24-
// Manages the lifecycle of the root application context
25-
sc.addListener(new ContextLoaderListener(root));
26-
27-
28-
29-
DispatcherServlet dv =new DispatcherServlet(new GenericWebApplicationContext());
30-
31-
ServletRegistration.Dynamic appServlet = sc.addServlet("test-mvc",dv );
32-
appServlet.setLoadOnStartup(1);
33-
appServlet.addMapping("/test/*");
34-
}
22+
// Manages the lifecycle of the root application context
23+
sc.addListener(new ContextLoaderListener(root));
3524

36-
}
25+
DispatcherServlet dv = new DispatcherServlet(new GenericWebApplicationContext());
3726

27+
ServletRegistration.Dynamic appServlet = sc.addServlet("test-mvc", dv);
28+
appServlet.setLoadOnStartup(1);
29+
appServlet.addMapping("/test/*");
30+
}
31+
}

0 commit comments

Comments
 (0)