@@ -97,16 +97,18 @@ protected void startContexts() {
9797 @ Override
9898 public void with (ModuleDefinition def , Stack <ModuleDefinition > parents ) {
9999 try {
100- ApplicationContext context = getApplicationContext (def .getName ());
100+ String moduleDefinitionName = def .getName ();
101+ log .debug (String .format ("Trying to obtain module [%s] context." , moduleDefinitionName ));
102+ ApplicationContext context = getApplicationContext (moduleDefinitionName );
101103 try {
102104 Runnable runnable = context .getBean ("moduleStartup" , Runnable .class );
103- log .info ("Starting module [" + def . getName () + "]" );
105+ log .info (String . format ( "Starting module [%s]." , moduleDefinitionName ) );
104106 runnable .run ();
105107 } catch (BeansException e ) {
106- // Ignore
108+ log . error ( String . format ( "Failed to start module [%s] due to: [%s]." , moduleDefinitionName , e . getMessage ()), e );
107109 }
108110 } catch (EmptyStackException e ) {
109- // The root context is already loaded, so ignore the exception
111+ log . error ( String . format ( "Failed to obtain module context due to [%s]. Using root context instead." , e . getMessage ()), e );
110112 }
111113 }
112114 });
@@ -117,10 +119,15 @@ protected void loadContexts() {
117119 @ Override
118120 public void with (ModuleDefinition def , Stack <ModuleDefinition > parents ) {
119121 try {
122+ String moduleDefinitionName = def .getName ();
123+ log .debug (String .format ("Trying to obtain module [%s] context." , moduleDefinitionName ));
120124 ApplicationContext parent = getApplicationContext (parents .peek ().getName ());
125+ log .debug (String .format ("Trying to load module [%s] context." , moduleDefinitionName ));
121126 loadContext (def , parent );
122127 } catch (EmptyStackException e ) {
123- // The root context is already loaded, so ignore the exception
128+ log .error (String .format ("Failed to obtain module context due to [%s]. Using root context instead." , e .getMessage ()), e );
129+ } catch (BeansException e ) {
130+ log .error (String .format ("Failed to load module [%s] due to: [%s]." , def .getName (), e .getMessage ()), e );
124131 }
125132 }
126133 });
0 commit comments