File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
src/main/java/modisefileupload/java/config Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ package modisefileupload .java .config ;
2
+
3
+ import javax .servlet .ServletContext ;
4
+ import javax .servlet .ServletException ;
5
+ import javax .servlet .ServletRegistration ;
6
+
7
+ import org .springframework .web .WebApplicationInitializer ;
8
+ import org .springframework .web .context .ContextLoaderListener ;
9
+ import org .springframework .web .context .support .AnnotationConfigWebApplicationContext ;
10
+ import org .springframework .web .servlet .DispatcherServlet ;
11
+
12
+ public class WebAppInitializer implements WebApplicationInitializer {
13
+
14
+ @ Override
15
+ public void onStartup (ServletContext container ) throws ServletException {
16
+ AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext ();
17
+ rootContext .register (WebConfig .class );
18
+ container .addListener (new ContextLoaderListener (rootContext ));
19
+ DispatcherServlet dispatcherServlet = new DispatcherServlet (rootContext );
20
+ ServletRegistration .Dynamic registration = container .addServlet ("dispatcherServlet" , dispatcherServlet );
21
+ registration .setLoadOnStartup (1 );
22
+ registration .addMapping ("/" );
23
+ }
24
+
25
+ }
You can’t perform that action at this time.
0 commit comments