use of org.springframework.context.support.AbstractRefreshableConfigApplicationContext in project kylo by Teradata.
the class SpringContextLoaderService method loadConfiurations.
/**
* Called by the framework to load controller configurations, this method
* will create a spring context
*
* @param context not used in this case
* @throws InitializationException an except thrown if there are any errors
*/
@OnEnabled
public void loadConfiurations(final ConfigurationContext context) throws InitializationException {
try {
AbstractRefreshableConfigApplicationContext appContext = new ClassPathXmlApplicationContext();
appContext.setClassLoader(getClass().getClassLoader());
appContext.setConfigLocation("application-context.xml");
getLogger().info("Refreshing spring context");
appContext.refresh();
getLogger().info("Spring context refreshed");
this.contextFuture.set(appContext);
} catch (BeansException | IllegalStateException e) {
getLogger().error("Failed to load spring configurations", e);
throw new InitializationException(e);
}
}
Aggregations