![JAR search and dependency download from the Maven repository](/logo.png)
com.github.bingoohuang.westcache.spring.WestCacheableScannerConfigurer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of westcache Show documentation
Show all versions of westcache Show documentation
java cache with unified administration
package com.github.bingoohuang.westcache.spring;
import lombok.Setter;
import lombok.val;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.util.StringUtils;
import static org.springframework.util.Assert.notNull;
public class WestCacheableScannerConfigurer
implements BeanDefinitionRegistryPostProcessor,
InitializingBean, ApplicationContextAware, BeanNameAware {
@Setter private String basePackage;
@Setter private ApplicationContext applicationContext;
@Setter private String beanName;
@Override
public void afterPropertiesSet() throws Exception {
notNull(this.basePackage, "Property 'basePackage' is required");
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
// left intentionally blank
}
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
val scanner = new WestCacheableClassPathScanner(registry);
scanner.setResourceLoader(this.applicationContext);
scanner.registerFilters();
scanner.scan(StringUtils.tokenizeToStringArray(this.basePackage,
ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy