DATACOUCH-509 - remove the configurer again
Boot figured out a better way to handle it, so we can get rid of it again.
This commit is contained in:
@@ -62,11 +62,7 @@ import static com.couchbase.client.java.ClusterOptions.*;
|
||||
* @author Subhashni Balakrishnan
|
||||
*/
|
||||
@Configuration
|
||||
public abstract class AbstractCouchbaseConfiguration implements CouchbaseConfigurer {
|
||||
|
||||
protected CouchbaseConfigurer couchbaseConfigurer() {
|
||||
return this;
|
||||
}
|
||||
public abstract class AbstractCouchbaseConfiguration {
|
||||
|
||||
public abstract String getConnectionString();
|
||||
|
||||
@@ -85,20 +81,18 @@ public abstract class AbstractCouchbaseConfiguration implements CouchbaseConfigu
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CouchbaseClientFactory couchbaseClientFactory() throws Exception {
|
||||
return new SimpleCouchbaseClientFactory(couchbaseConfigurer().couchbaseCluster(), getBucketName(), getScopeName());
|
||||
public CouchbaseClientFactory couchbaseClientFactory(Cluster couchbaseCluster) {
|
||||
return new SimpleCouchbaseClientFactory(couchbaseCluster, getBucketName(), getScopeName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public Cluster couchbaseCluster() throws Exception {
|
||||
public Cluster couchbaseCluster(ClusterEnvironment couchbaseClusterEnvironment) {
|
||||
return Cluster.connect(
|
||||
getConnectionString(),
|
||||
clusterOptions(authenticator()).environment(couchbaseConfigurer().couchbaseClusterEnvironment())
|
||||
clusterOptions(authenticator()).environment(couchbaseClusterEnvironment)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
public ClusterEnvironment couchbaseClusterEnvironment() {
|
||||
ClusterEnvironment.Builder builder = ClusterEnvironment.builder();
|
||||
@@ -148,7 +142,7 @@ public abstract class AbstractCouchbaseConfiguration implements CouchbaseConfigu
|
||||
*/
|
||||
protected Set<Class<?>> getInitialEntitySet() throws ClassNotFoundException {
|
||||
String basePackage = getMappingBasePackage();
|
||||
Set<Class<?>> initialEntitySet = new HashSet<Class<?>>();
|
||||
Set<Class<?>> initialEntitySet = new HashSet<>();
|
||||
|
||||
if (StringUtils.hasText(basePackage)) {
|
||||
ClassPathScanningCandidateComponentProvider componentProvider = new ClassPathScanningCandidateComponentProvider(
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.couchbase.config;
|
||||
|
||||
import com.couchbase.client.java.Cluster;
|
||||
import com.couchbase.client.java.env.ClusterEnvironment;
|
||||
|
||||
/**
|
||||
* Strategy interface for users to provide as a factory for custom components needed
|
||||
* by the Couchbase integration.
|
||||
*
|
||||
* This allows to centralize instantiation of Couchbase SDK core elements.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Michael Nitschinger
|
||||
*/
|
||||
public interface CouchbaseConfigurer {
|
||||
|
||||
/**
|
||||
* Set up the underlying main {@link ClusterEnvironment}, allowing tuning of the Couchbase SDK.
|
||||
*
|
||||
* @throws Exception in case of error during the ClusterEnvironment instantiation.
|
||||
*/
|
||||
ClusterEnvironment couchbaseClusterEnvironment() throws Exception;
|
||||
|
||||
/**
|
||||
* Set up the underlying main {@link Cluster} reference to be used by the Spring Data framework
|
||||
* when storing into Couchbase.
|
||||
*
|
||||
* @throws Exception in case of error during the Cluster instantiation.
|
||||
*/
|
||||
Cluster couchbaseCluster() throws Exception;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user