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);

forest
0 声望1 粉丝