All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.bootfastconfig.cache.CacheAuotConfigSelector Maven / Gradle / Ivy

Go to download

Parent pom providing dependency and plugin management for applications built with Maven

The newest version!
package com.github.bootfastconfig.cache;


import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.util.ClassUtils;

public class CacheAuotConfigSelector implements ImportSelector {


    private static final String ENABLE_CACHING = "org.springframework.cache.annotation.EnableCaching";

    private static final boolean IS_ENABLE_CACHING;


    static {
        ClassLoader classLoader = CacheAuotConfigSelector.class.getClassLoader();
        IS_ENABLE_CACHING = ClassUtils.isPresent(ENABLE_CACHING, classLoader);
    }


    @Override
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
        if (IS_ENABLE_CACHING) {
            AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(ENABLE_CACHING, false));
            if (annotationAttributes != null) {
                return new String[]{CacheAuotConfig.class.getName(), "com.github.bootfastconfig.cache.BindScannerRegistrar"};
            }

        }
        return new String[0];
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy