
be.bagofwords.application.ApplicationManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bow-utils Show documentation
Show all versions of bow-utils Show documentation
Utility classes that are used in the count-db project and other bow-* projects
package be.bagofwords.application;
import be.bagofwords.ui.UI;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
public class ApplicationManager {
public static void runSafely(ApplicationContextFactory applicationContextFactory) {
AnnotationConfigApplicationContext applicationContext = null;
try {
applicationContext = applicationContextFactory.createApplicationContext();
MainClass instance = applicationContext.getBean(MainClass.class);
applicationContext.start();
instance.run();
} catch (Throwable exp) {
UI.writeError("Received unexpected exception, terminating application.", exp);
} finally {
if (applicationContext != null) {
applicationContext.close();
}
}
UI.write("Application was terminated. Goodbye!");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy