File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -498,6 +498,7 @@ static class FactoryOrder {
498
498
private final Set <String > moduleNames = new LinkedHashSet <>();
499
499
private final List <BeanContextFactory > factories = new ArrayList <>();
500
500
private final List <FactoryState > queue = new ArrayList <>();
501
+ private final List <FactoryState > queueNoDependencies = new ArrayList <>();
501
502
502
503
private final Map <String , FactoryList > providesMap = new HashMap <>();
503
504
@@ -518,7 +519,13 @@ void add(BeanContextFactory factory) {
518
519
}
519
520
}
520
521
if (isEmpty (factory .getDependsOn ())) {
521
- push (wrappedFactory );
522
+ if (!isEmpty (factory .getProvides ())) {
523
+ // only has 'provides' so we can push this
524
+ push (wrappedFactory );
525
+ } else {
526
+ // hold until after all the 'provides only' modules are added
527
+ queueNoDependencies .add (wrappedFactory );
528
+ }
522
529
} else {
523
530
// queue it to process by dependency ordering
524
531
queue .add (wrappedFactory );
@@ -550,6 +557,11 @@ private void push(FactoryState factory) {
550
557
* Order the factories returning the ordered list of module names.
551
558
*/
552
559
Set <String > orderFactories () {
560
+ // push the 'no dependency' modules after the 'provides only' ones
561
+ // as this is more intuitive for the simple (only provides modules case)
562
+ for (FactoryState factoryState : queueNoDependencies ) {
563
+ push (factoryState );
564
+ }
553
565
processQueue ();
554
566
return moduleNames ;
555
567
}
You can’t perform that action at this time.
0 commit comments