|
|
|
|
@@ -13,7 +13,6 @@
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package org.springframework.data.gemfire.config.annotation;
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.BeansException;
|
|
|
|
|
@@ -21,6 +20,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
|
|
|
|
|
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.support.GemfireBeanFactoryLocator;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -33,6 +33,9 @@ import org.springframework.data.gemfire.support.GemfireBeanFactoryLocator;
|
|
|
|
|
* @see org.springframework.context.annotation.Bean
|
|
|
|
|
* @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.ClientCacheConfigurer
|
|
|
|
|
* @see org.springframework.data.gemfire.config.annotation.PeerCacheConfigurer
|
|
|
|
|
* @see org.springframework.data.gemfire.config.annotation.EnableBeanFactoryLocator
|
|
|
|
|
* @see org.springframework.data.gemfire.support.GemfireBeanFactoryLocator
|
|
|
|
|
* @since 2.0.0
|
|
|
|
|
@@ -42,19 +45,19 @@ import org.springframework.data.gemfire.support.GemfireBeanFactoryLocator;
|
|
|
|
|
public class BeanFactoryLocatorConfiguration {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Declares and registers a Spring {@link BeanPostProcessor} and post processes a Spring Data GemFire/Geode
|
|
|
|
|
* {@link CacheFactoryBean} by setting the {@literal useBeanFactoryLocator} property to {@literal true}.
|
|
|
|
|
* Declares and registers a Spring {@link BeanPostProcessor} bean to post process a Spring Data Geode
|
|
|
|
|
* {@link CacheFactoryBean} or {@link ClientCacheFactoryBean} by setting the {@literal useBeanFactoryLocator}
|
|
|
|
|
* property to {@literal true}.
|
|
|
|
|
*
|
|
|
|
|
* @return a Spring {@link BeanPostProcessor} used to post process the SDG {@link CacheFactoryBean}.
|
|
|
|
|
* @return a Spring {@link BeanPostProcessor} used to post process an SDG {@link CacheFactoryBean}.
|
|
|
|
|
* @see org.springframework.beans.factory.config.BeanPostProcessor
|
|
|
|
|
*/
|
|
|
|
|
@Bean
|
|
|
|
|
public BeanPostProcessor cacheFactoryBeanPostProcessor() {
|
|
|
|
|
public BeanPostProcessor useBeanFactoryLocatorBeanPostProcessor() {
|
|
|
|
|
|
|
|
|
|
return new BeanPostProcessor() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@SuppressWarnings("all")
|
|
|
|
|
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
|
|
|
|
|
|
|
|
|
if (bean instanceof CacheFactoryBean) {
|
|
|
|
|
@@ -65,4 +68,30 @@ public class BeanFactoryLocatorConfiguration {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Declares and registers a {@link ClientCacheConfigurer} bean to configure a {@link ClientCacheFactoryBean}
|
|
|
|
|
* by setting the {@literal useBeanFactoryLocator} property to {@literal true}.
|
|
|
|
|
*
|
|
|
|
|
* @return a {@link ClientCacheConfigurer} used to configure and set the SDG {@link ClientCacheFactoryBean}'s
|
|
|
|
|
* {@literal useBeanFactoryLocator} property to {@literal true}.
|
|
|
|
|
* @see org.springframework.data.gemfire.config.annotation.ClientCacheConfigurer
|
|
|
|
|
*/
|
|
|
|
|
@Bean
|
|
|
|
|
public ClientCacheConfigurer useBeanFactoryLocatorClientCacheConfigurer() {
|
|
|
|
|
return (beanName, bean) -> bean.setUseBeanFactoryLocator(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Declares and registers a {@link PeerCacheConfigurer} bean to configure a {@link CacheFactoryBean}
|
|
|
|
|
* by setting the {@literal useBeanFactoryLocator} property to {@literal true}.
|
|
|
|
|
*
|
|
|
|
|
* @return a {@link PeerCacheConfigurer} used to configure and set the SDG {@link CacheFactoryBean}'s
|
|
|
|
|
* {@literal useBeanFactoryLocator} property to {@literal true}.
|
|
|
|
|
* @see org.springframework.data.gemfire.config.annotation.PeerCacheConfigurer
|
|
|
|
|
*/
|
|
|
|
|
@Bean
|
|
|
|
|
public PeerCacheConfigurer useBeanFactoryLocatorPeerCacheConfigurer() {
|
|
|
|
|
return (beanName, bean) -> bean.setUseBeanFactoryLocator(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|