设为首页 加入收藏

TOP

SpringBoot自动装配深入理解(七)
2018-06-04 08:51:23 】 浏览:1419
Tags:SpringBoot 自动 装配 深入 理解
sp;           fireAutoConfigurationImportEvents(configurations, exclusions);
            return configurations.toArray(new String[configurations.size()]);
        }
        catch (IOException ex) {
            throw new IllegalStateException(ex);
        }
    }


    protected boolean isEnabled(AnnotationMetadata metadata) {
        return true;
    }


    /**
    * Return the appropriate {@link AnnotationAttributes} from the
    * {@link AnnotationMetadata}. By default this method will return attributes for
    * {@link #getAnnotationClass()}.
    * @param metadata the annotation metadata
    * @return annotation attributes
    */
    protected AnnotationAttributes getAttributes(AnnotationMetadata metadata) {
        String name = getAnnotationClass().getName();
        AnnotationAttributes attributes = AnnotationAttributes
                .fromMap(metadata.getAnnotationAttributes(name, true));
        Assert.notNull(attributes,
                "No auto-configuration attributes found. Is " + metadata.getClassName()
                        + " annotated with " + ClassUtils.getShortName(name) + "?");
        return attributes;
    }


    /**
    * Return the source annotation class used by the selector.
    * @return the annotation class
    */
    protected Class<?> getAnnotationClass() {
        return EnableAutoConfiguration.class;
    }


    /**
    * Return the auto-configuration class names that should be considered. By default
    * this method will load candidates using {@link SpringFactoriesLoader} with
    * {@link #getSpringFactoriesLoaderFactoryClass()}.
    * @param metadata the source metadata
    * @param attributes the {@link #getAttributes(AnnotationMetadata) annotation
    * attributes}
    * @return a list of candidate configurations
    */
    protected List<String> getCandidateConfigurations(AnnotationMetadata metadata,
            AnnotationAttributes attributes) {
        List<String> configurations = SpringFactoriesLoader.loadFactoryNames(
                getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader());
        Assert.notEmpty(configurations,
                "No auto configuration classes found in META-INF/spring.factories. If you "
                        + "are using a custom packaging, make sure that file is correct.");
        return configurations;
    }


    /**
    * Return the class used by {@link SpringFacto

首页 上一页 4 5 6 7 8 9 10 下一页 尾页 7/17/17
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇SpringBoot自动装配初步认识 下一篇智能指针之 shared_ptr

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目