Created
November 18, 2012 03:38
-
-
Save benhardy/4103344 to your computer and use it in GitHub Desktop.
webapp config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Our instance of WebApplicationInitializer. This replaces web.xml for the initial | |
* configuration of the servlet. | |
*/ | |
class WebAppInit extends WebApplicationInitializer { | |
override def onStartup(servletContext: ServletContext) { | |
// Create the 'root' Spring application context | |
val root = new AnnotationConfigWebApplicationContext() | |
root.scan("skellybones") | |
// Manages the lifecycle of the root application context | |
servletContext.addListener(new ContextLoaderListener(root)) | |
val servlet = new DispatcherServlet(root) | |
val appServlet = servletContext.addServlet("appServlet", servlet) | |
appServlet.setLoadOnStartup(1) | |
val mappingConflicts = appServlet.addMapping("/") | |
if (!mappingConflicts.isEmpty) { | |
throw new IllegalStateException("'appServlet' could not be mapped to '/'") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment