Skip to content

Instantly share code, notes, and snippets.

@zhentao
Created February 22, 2016 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhentao/20a7738ea6d4659d8cdc to your computer and use it in GitHub Desktop.
Save zhentao/20a7738ea6d4659d8cdc to your computer and use it in GitHub Desktop.
@Override
protected SparkApplication getApplication(FilterConfig filterConfig) throws ServletException {
Class<?>[] configClasses = getConfigClasses(filterConfig);
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(configClasses)) {
String applicationClassName = filterConfig.getInitParameter(APPLICATION_CLASS_PARAM);
try {
return (SparkApplication) context.getBean(Class.forName(applicationClassName));
} catch (ClassNotFoundException e) {
throw new ServletException(e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment