DATAGEODE-198 - Modify all configuration classes to use lazy-resolving, composable Configurer implementations for resolving the user-defined, application Configurers.
This commit is contained in:
@@ -14,18 +14,14 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static org.springframework.data.gemfire.util.CollectionUtils.nullSafeMap;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
||||
@@ -70,9 +66,11 @@ public class AddCacheServerConfiguration extends AbstractAnnotationConfigSupport
|
||||
@Autowired(required = false)
|
||||
private List<CacheServerConfigurer> cacheServerConfigurers = Collections.emptyList();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Class<? extends Annotation> getAnnotationType() {
|
||||
return EnableCacheServer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
|
||||
|
||||
@@ -183,26 +181,15 @@ public class AddCacheServerConfiguration extends AbstractAnnotationConfigSupport
|
||||
(Boolean) enableCacheServerAttributes.get("tcpNoDelay"))));
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
private List<CacheServerConfigurer> resolveCacheServerConfigurers() {
|
||||
|
||||
return Optional.ofNullable(this.cacheServerConfigurers)
|
||||
.filter(cacheServerConfigurers -> !cacheServerConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
Map<String, CacheServerConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
.getBeansOfType(CacheServerConfigurer.class, true, false);
|
||||
|
||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||
})
|
||||
.orElseGet(Collections::emptyList)
|
||||
);
|
||||
Collections.singletonList(LazyResolvingComposableCacheServerConfigurer.create(getBeanFactory())));
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
protected String registerCacheServerFactoryBeanDefinition(AbstractBeanDefinition beanDefinition, String beanName,
|
||||
BeanDefinitionRegistry registry) {
|
||||
|
||||
@@ -217,14 +204,7 @@ public class AddCacheServerConfiguration extends AbstractAnnotationConfigSupport
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
protected BeanDefinitionHolder newBeanDefinitionHolder(BeanDefinition beanDefinition, String beanName) {
|
||||
return new BeanDefinitionHolder(beanDefinition, beanName);
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
@Override
|
||||
protected Class getAnnotationType() {
|
||||
return EnableCacheServer.class;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,21 +14,18 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static java.util.Arrays.stream;
|
||||
import static org.springframework.data.gemfire.util.ArrayUtils.nullSafeArray;
|
||||
import static org.springframework.data.gemfire.util.CollectionUtils.nullSafeMap;
|
||||
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalArgumentException;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
@@ -68,9 +65,11 @@ public class AddPoolConfiguration extends AbstractAnnotationConfigSupport
|
||||
@Autowired(required = false)
|
||||
private List<PoolConfigurer> poolConfigurers = Collections.emptyList();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Class<? extends Annotation> getAnnotationType() {
|
||||
return EnablePool.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
|
||||
|
||||
@@ -202,20 +201,9 @@ public class AddPoolConfiguration extends AbstractAnnotationConfigSupport
|
||||
|
||||
return Optional.ofNullable(this.poolConfigurers)
|
||||
.filter(poolConfigurers -> !poolConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
Map<String, PoolConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
.getBeansOfType(PoolConfigurer.class, true, false);
|
||||
|
||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||
})
|
||||
.orElseGet(Collections::emptyList)
|
||||
);
|
||||
.orElseGet(() -> Collections.singletonList(LazyResolvingComposablePoolConfigurer.create(getBeanFactory())));
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
protected String getAndValidatePoolName(Map<String, Object> enablePoolAttributes) {
|
||||
|
||||
return Optional.ofNullable((String) enablePoolAttributes.get("name"))
|
||||
@@ -300,9 +288,4 @@ public class AddPoolConfiguration extends AbstractAnnotationConfigSupport
|
||||
protected ConnectionEndpoint newConnectionEndpoint(String host, Integer port) {
|
||||
return new ConnectionEndpoint(host, port);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class getAnnotationType() {
|
||||
return EnablePool.class;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,19 +14,15 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static org.springframework.data.gemfire.util.CollectionUtils.nullSafeMap;
|
||||
import static org.springframework.data.gemfire.util.CollectionUtils.nullSafeSet;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
@@ -36,7 +32,7 @@ import org.apache.geode.cache.server.CacheServer;
|
||||
import org.apache.geode.cache.server.ClientSubscriptionConfig;
|
||||
import org.apache.geode.cache.server.ServerLoadProbe;
|
||||
import org.apache.shiro.util.Assert;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -146,20 +142,7 @@ public class CacheServerConfiguration extends PeerCacheConfiguration {
|
||||
return Optional.ofNullable(this.cacheServerConfigurers)
|
||||
.filter(cacheServerConfigurers -> !cacheServerConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
|
||||
Map<String, CacheServerConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
.getBeansOfType(CacheServerConfigurer.class, true, false);
|
||||
|
||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||
|
||||
})
|
||||
.orElseGet(Collections::emptyList)
|
||||
);
|
||||
|
||||
Collections.singletonList(LazyResolvingComposableCacheServerConfigurer.create(getBeanFactory())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,14 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Arrays.stream;
|
||||
import static org.springframework.data.gemfire.util.ArrayUtils.asArray;
|
||||
import static org.springframework.data.gemfire.util.ArrayUtils.nullSafeArray;
|
||||
import static org.springframework.data.gemfire.util.CollectionUtils.nullSafeMap;
|
||||
import static org.springframework.data.gemfire.util.StreamUtils.concat;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
@@ -31,7 +29,6 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -47,9 +44,9 @@ import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.RegionShortcut;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
import org.apache.geode.cache.client.Pool;
|
||||
|
||||
import org.springframework.beans.BeanInstantiationException;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
@@ -340,18 +337,7 @@ public class CachingDefinedRegionsConfiguration extends AbstractAnnotationConfig
|
||||
return Optional.ofNullable(this.regionConfigurers)
|
||||
.filter(regionConfigurers -> !regionConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
|
||||
Map<String, RegionConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
.getBeansOfType(RegionConfigurer.class, true, false);
|
||||
|
||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||
|
||||
})
|
||||
.orElseGet(Collections::emptyList)
|
||||
);
|
||||
Collections.singletonList(LazyResolvingComposableRegionConfigurer.create(getBeanFactory())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,23 +14,19 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static org.springframework.data.gemfire.util.CollectionUtils.nullSafeMap;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.apache.geode.cache.client.Pool;
|
||||
import org.apache.geode.cache.server.CacheServer;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
@@ -160,19 +156,7 @@ public class ClientCacheConfiguration extends AbstractCacheConfiguration {
|
||||
return Optional.ofNullable(this.clientCacheConfigurers)
|
||||
.filter(clientCacheConfigurers -> !clientCacheConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
|
||||
Map<String, ClientCacheConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
.getBeansOfType(ClientCacheConfigurer.class, true, false);
|
||||
|
||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||
|
||||
})
|
||||
.orElseGet(Collections::emptyList)
|
||||
);
|
||||
Collections.singletonList(LazyResolvingComposableClientCacheConfigurer.create(getBeanFactory())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,24 +14,21 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static java.util.Arrays.stream;
|
||||
import static org.springframework.data.gemfire.util.ArrayUtils.nullSafeArray;
|
||||
import static org.springframework.data.gemfire.util.CollectionUtils.nullSafeMap;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.geode.cache.DiskStore;
|
||||
import org.apache.geode.cache.DiskStoreFactory;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
@@ -92,7 +89,7 @@ public class DiskStoreConfiguration extends AbstractAnnotationConfigSupport
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableDiskStore
|
||||
*/
|
||||
@Override
|
||||
protected Class getAnnotationType() {
|
||||
protected Class<? extends Annotation> getAnnotationType() {
|
||||
return EnableDiskStore.class;
|
||||
}
|
||||
|
||||
@@ -111,7 +108,6 @@ public class DiskStoreConfiguration extends AbstractAnnotationConfigSupport
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
protected void registerDiskStoreBeanDefinition(AnnotationAttributes enableDiskStoreAttributes,
|
||||
BeanDefinitionRegistry registry) {
|
||||
|
||||
@@ -205,27 +201,14 @@ public class DiskStoreConfiguration extends AbstractAnnotationConfigSupport
|
||||
registry.registerBeanDefinition(diskStoreName, diskStoreFactoryBeanBuilder.getBeanDefinition());
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
private List<DiskStoreConfigurer> resolveDiskStoreConfigurers() {
|
||||
|
||||
return Optional.ofNullable(this.diskStoreConfigurers)
|
||||
.filter(diskStoreConfigurers -> !diskStoreConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
|
||||
Map<String, DiskStoreConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
.getBeansOfType(DiskStoreConfigurer.class, true, false);
|
||||
|
||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||
|
||||
})
|
||||
.orElseGet(Collections::emptyList)
|
||||
);
|
||||
Collections.singletonList(LazyResolvingComposableDiskStoreConfigurer.create(getBeanFactory())));
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
protected BeanDefinitionBuilder resolveDiskStoreDirectories(String diskStoreName,
|
||||
AnnotationAttributes enableDiskStoreAttributes, BeanDefinitionBuilder diskStoreFactoryBeanBuilder) {
|
||||
|
||||
@@ -304,7 +287,6 @@ public class DiskStoreConfiguration extends AbstractAnnotationConfigSupport
|
||||
return diskStoreFactoryBeanBuilder;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
@SuppressWarnings("unused")
|
||||
private String resolveDiskStoreDirectoryLocation(String... locations) {
|
||||
|
||||
@@ -314,7 +296,6 @@ public class DiskStoreConfiguration extends AbstractAnnotationConfigSupport
|
||||
.orElse(".");
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
private Integer resolveDiskStoreDirectorySize(Integer... sizes) {
|
||||
|
||||
return stream(nullSafeArray(sizes, Integer.class))
|
||||
@@ -323,7 +304,6 @@ public class DiskStoreConfiguration extends AbstractAnnotationConfigSupport
|
||||
.orElse(Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
protected ManagedList<BeanDefinition> parseDiskStoreDirectories(AnnotationAttributes enableDiskStoreAttributes) {
|
||||
|
||||
AnnotationAttributes[] diskDirectories =
|
||||
@@ -338,7 +318,6 @@ public class DiskStoreConfiguration extends AbstractAnnotationConfigSupport
|
||||
return diskDirectoryBeans;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
private BeanDefinition newDiskStoreDirectoryBean(String location, Integer maxSize) {
|
||||
|
||||
BeanDefinitionBuilder diskDirectoryBuilder =
|
||||
@@ -350,7 +329,6 @@ public class DiskStoreConfiguration extends AbstractAnnotationConfigSupport
|
||||
return diskDirectoryBuilder.getBeanDefinition();
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
private <T> BeanDefinitionBuilder setPropertyValueIfNotDefault(BeanDefinitionBuilder beanDefinitionBuilder,
|
||||
String propertyName, T value, T defaultValue) {
|
||||
|
||||
|
||||
@@ -14,13 +14,11 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static java.util.Arrays.stream;
|
||||
import static org.springframework.data.gemfire.util.ArrayUtils.defaultIfEmpty;
|
||||
import static org.springframework.data.gemfire.util.ArrayUtils.nullSafeArray;
|
||||
import static org.springframework.data.gemfire.util.CollectionUtils.nullSafeMap;
|
||||
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalArgumentException;
|
||||
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalStateException;
|
||||
|
||||
@@ -28,7 +26,6 @@ import java.lang.annotation.Annotation;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -38,9 +35,9 @@ import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.RegionShortcut;
|
||||
import org.apache.geode.cache.Scope;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
@@ -353,18 +350,7 @@ public class EntityDefinedRegionsConfiguration extends AbstractAnnotationConfigS
|
||||
return Optional.ofNullable(this.regionConfigurers)
|
||||
.filter(regionConfigurers -> !regionConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
|
||||
Map<String, RegionConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
.getBeansOfType(RegionConfigurer.class, true, false);
|
||||
|
||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||
|
||||
})
|
||||
.orElseGet(Collections::emptyList)
|
||||
);
|
||||
Collections.singletonList(LazyResolvingComposableRegionConfigurer.create(getBeanFactory())));
|
||||
}
|
||||
|
||||
protected BeanDefinitionBuilder setRegionAttributes(BeanDefinitionBuilder regionFactoryBeanBuilder,
|
||||
|
||||
@@ -14,23 +14,19 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static org.springframework.data.gemfire.util.CollectionUtils.nullSafeMap;
|
||||
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalArgumentException;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.lucene.LuceneIndex;
|
||||
import org.apache.geode.cache.query.Index;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
@@ -304,16 +300,7 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration {
|
||||
return Optional.ofNullable(this.indexConfigurers)
|
||||
.filter(indexConfigurers -> !indexConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
Map<String, IndexConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
.getBeansOfType(IndexConfigurer.class, true, false);
|
||||
|
||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||
})
|
||||
.orElseGet(Collections::emptyList)
|
||||
);
|
||||
Collections.singletonList(LazyResolvingComposableIndexConfigurer.create(getBeanFactory())));
|
||||
}
|
||||
|
||||
private boolean resolveDefine(AnnotationAttributes enableIndexingAttributes) {
|
||||
|
||||
@@ -14,20 +14,15 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static org.springframework.data.gemfire.util.CollectionUtils.nullSafeMap;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -106,19 +101,7 @@ public class PeerCacheConfiguration extends AbstractCacheConfiguration {
|
||||
return Optional.ofNullable(this.peerCacheConfigurers)
|
||||
.filter(peerCacheConfigurers -> !peerCacheConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
|
||||
Map<String, PeerCacheConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
.getBeansOfType(PeerCacheConfigurer.class, true, false);
|
||||
|
||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||
|
||||
})
|
||||
.orElseGet(Collections::emptyList)
|
||||
);
|
||||
Collections.singletonList(LazyResolvingComposablePeerCacheConfigurer.create(getBeanFactory())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user