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

com.alicp.jetcache.anno.config.ConfigSelector Maven / Gradle / Ivy

The newest version!
package com.alicp.jetcache.anno.config;

import org.springframework.context.annotation.AdviceMode;
import org.springframework.context.annotation.AdviceModeImportSelector;
import org.springframework.context.annotation.AutoProxyRegistrar;

import java.util.ArrayList;
import java.util.List;

/**
 * Created on 2016/11/16.
 *
 */
public class ConfigSelector extends AdviceModeImportSelector {

    @Override
    public String[] selectImports(AdviceMode adviceMode) {
        switch (adviceMode) {
            case PROXY:
                return getProxyImports();
            case ASPECTJ:
//                return getAspectJImports();
            default:
                return null;
        }
    }

    /**
     * Return the imports to use if the {@link AdviceMode} is set to {@link AdviceMode#PROXY}.
     * 

Take care of adding the necessary JSR-107 import if it is available. */ private String[] getProxyImports() { List result = new ArrayList(); result.add(AutoProxyRegistrar.class.getName()); result.add(JetCacheProxyConfiguration.class.getName()); return result.toArray(new String[result.size()]); } /** * Return the imports to use if the {@link AdviceMode} is set to {@link AdviceMode#ASPECTJ}. *

Take care of adding the necessary JSR-107 import if it is available. */ // private String[] getAspectJImports() { // List result = new ArrayList(); // result.add(CACHE_ASPECT_CONFIGURATION_CLASS_NAME); // return result.toArray(new String[result.size()]); // } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy