乐趣区

关于java:AutoConfigureAfter和AutoConfigureOrder的使用

https://blog.csdn.net/Vansonh…

源码:

public List<String> getInPriorityOrder(Collection<String> classNames) {
        final AutoConfigurationSorter.AutoConfigurationClasses classes = new AutoConfigurationSorter.AutoConfigurationClasses(this.metadataReaderFactory, this.autoConfig
        List<String> orderedClassNames = new ArrayList(classNames);
        // ⾸先依据 ASCII 来进⾏排序
        Collections.sort(orderedClassNames);
        // 依据 Order
        Collections.sort(orderedClassNames, new Comparator<String>() {public int compare(String o1, String o2) {int i1 = classes.get(o1).getOrder();
                int i2 = classes.get(o2).getOrder();
                return i1 < i2 ? -1 : (i1 > i2 ? 1 : 0);
            }
        });
        // 依据 @AutoConfigureAfter @AutoConfigureBefore
        List<String> orderedClassNames = this.sortByAnnotation(classes, orderedClassNames);
退出移动版