Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,16 @@ protected void startContexts() {
@Override
public void with(ModuleDefinition def, Stack<ModuleDefinition> parents) {
try {
String moduleDefinitionName = def.getName();
log.debug(String.format("Trying to obtain module [%s] context.", moduleDefinitionName));
ApplicationContext context = getApplicationContext(moduleDefinitionName);
ApplicationContext context = getApplicationContext(def.getName());
try {
Runnable runnable = context.getBean("moduleStartup", Runnable.class);
log.info(String.format("Starting module [%s].", moduleDefinitionName));
log.info("Starting module [" + def.getName() + "]");
runnable.run();
} catch (BeansException e) {
log.error(String.format("Failed to start module [%s] due to: [%s].", moduleDefinitionName, e.getMessage()), e);
// Ignore
}
} catch (EmptyStackException e) {
log.error(String.format("Failed to obtain module context due to [%s]. Using root context instead.", e.getMessage()), e);
// The root context is already loaded, so ignore the exception
}
}
});
Expand All @@ -119,15 +117,10 @@ protected void loadContexts() {
@Override
public void with(ModuleDefinition def, Stack<ModuleDefinition> parents) {
try {
String moduleDefinitionName = def.getName();
log.debug(String.format("Trying to obtain module [%s] context.", moduleDefinitionName));
ApplicationContext parent = getApplicationContext(parents.peek().getName());
log.debug(String.format("Trying to load module [%s] context.", moduleDefinitionName));
loadContext(def, parent);
} catch (EmptyStackException e) {
log.error(String.format("Failed to obtain module context due to [%s]. Using root context instead.", e.getMessage()), e);
} catch (BeansException e) {
log.error(String.format("Failed to load module [%s] due to: [%s].", def.getName(), e.getMessage()), e);
// The root context is already loaded, so ignore the exception
}
}
});
Expand Down