@@ -259,6 +259,22 @@ public void loadModules(boolean failOnOneError) throws QuickStartModuleLoaderExc
259259 throw new QuickStartModuleLoaderException .Construction (null , "No modules were constructed." , null );
260260 }
261261
262+ // Enter Config Adapter phase - attaching before enabling so that enable methods can get any associated configurations.
263+ for (String s : modules .keySet ()) {
264+ Module m = modules .get (s );
265+ Optional <AbstractConfigAdapter <?>> a = m .getConfigAdapter ();
266+ if (a .isPresent ()) {
267+ try {
268+ config .attachConfigAdapter (s , a .get ());
269+ } catch (IOException e ) {
270+ e .printStackTrace ();
271+ if (failOnOneError ) {
272+ throw new QuickStartModuleLoaderException .Enabling (m .getClass (), "Failed to attach config." , e );
273+ }
274+ }
275+ }
276+ }
277+
262278 // Enter Enable phase.
263279 Map <String , Module > c = new HashMap <>(modules );
264280 for (String s : c .keySet ()) {
@@ -267,18 +283,6 @@ public void loadModules(boolean failOnOneError) throws QuickStartModuleLoaderExc
267283 try {
268284 Module m = modules .get (s );
269285 constructor .enableModule (m );
270- Optional <AbstractConfigAdapter <?>> a = m .getConfigAdapter ();
271- if (a .isPresent ()) {
272- try {
273- config .attachConfigAdapter (s , a .get ());
274- } catch (IOException e ) {
275- e .printStackTrace ();
276- if (failOnOneError ) {
277- throw new QuickStartModuleLoaderException .Enabling (m .getClass (), "Failed to attach config." , e );
278- }
279- }
280- }
281-
282286 ms .setPhase (ModulePhase .ENABLED );
283287 } catch (Exception construction ) {
284288 construction .printStackTrace ();
0 commit comments