Replace o.s.b.f.c.BeanPostProcessor with @EnableBeanFactoryLocator annotation.

This commit is contained in:
John Blum
2018-05-28 21:42:53 -07:00
parent eb32d516d4
commit fe75f1da94

View File

@@ -16,19 +16,15 @@
package org.springframework.boot.data.geode.autoconfigure;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.gemfire.CacheFactoryBean;
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
import org.springframework.data.gemfire.config.annotation.ApacheShiroSecurityConfiguration;
import org.springframework.data.gemfire.config.annotation.EnableBeanFactoryLocator;
import org.springframework.data.gemfire.config.annotation.EnableSecurity;
import org.springframework.data.gemfire.config.annotation.GeodeIntegratedSecurityConfiguration;
import org.springframework.lang.Nullable;
/**
* Spring Boot {@link EnableAutoConfiguration auto-configuration} enabling Apache Geode's Security functionality,
@@ -36,12 +32,12 @@ import org.springframework.lang.Nullable;
*
* @author John Blum
* @see org.apache.geode.security.SecurityManager
* @see org.springframework.beans.factory.config.BeanPostProcessor
* @see org.springframework.boot.autoconfigure.EnableAutoConfiguration
* @see org.springframework.context.annotation.Configuration
* @see org.springframework.data.gemfire.CacheFactoryBean
* @see org.springframework.data.gemfire.client.ClientCacheFactoryBean
* @see org.springframework.data.gemfire.config.annotation.ApacheShiroSecurityConfiguration
* @see org.springframework.data.gemfire.config.annotation.EnableBeanFactoryLocator
* @see org.springframework.data.gemfire.config.annotation.EnableSecurity
* @see org.springframework.data.gemfire.config.annotation.GeodeIntegratedSecurityConfiguration
* @see org.springframework.data.gemfire.config.annotation.PeerCacheConfigurer
@@ -54,32 +50,9 @@ import org.springframework.lang.Nullable;
ApacheShiroSecurityConfiguration.class,
GeodeIntegratedSecurityConfiguration.class
})
@EnableBeanFactoryLocator
@EnableSecurity(securityManagerClassName = "org.springframework.boot.data.geode.security.support.SecurityManagerProxy")
@SuppressWarnings("unused")
public class PeerSecurityAutoConfiguration {
@Bean
@SuppressWarnings("all")
BeanPostProcessor cacheFactoryBeanPostProcessor() {
return new BeanPostProcessor() {
@Nullable @Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof CacheFactoryBean) {
((CacheFactoryBean) bean).setUseBeanFactoryLocator(true);
}
return bean;
}
};
}
/*
PeerCacheConfigurer gemfireCacheUseBeanFactoryLocatorConfigurer() {
return (beanName, cacheFactoryBean) -> cacheFactoryBean.setUseBeanFactoryLocator(true);
}
*/
}