关于java:AutoConfigureAfter和AutoConfigureOrder的使用

52次阅读

共计 687 个字符,预计需要花费 2 分钟才能阅读完成。

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

正文完
 0