Spring data couchbase upgrade from 3.2.1 to 4.2.1

Hello ,

Our project was in spring boot version 2.2.1 (spring-data-couchbase version 2.2.1 and couchbase SDK 3.2.1) , we have to upgrade this project to Spring boot 2.4.1 (spring-data-couchbase version 2.4.1 and couchbase SDK 4.2.1) , a lot of things have changed from couchbase SDK 3.x to 4.x , which are captured in the document here ,

But still I could not find some of things or configuration and how to do them in the newer version ,

from the older project in version 2.2.1 ,

QueryServiceConfig queryServiceConfig =
        QueryServiceConfig.create(queryserviceMinEndpoint, queryserviceMaxEndpoint);
    return DefaultCouchbaseEnvironment.builder()

It seems in the newer version they have removed QueryServiceConfig and DefaultCouchbaseEnvironment classes , Does anyone know how to define these configs in the newer version ? I mean the autoreleaseAfter , queryservice minEndpoints and maxEndpoints , I tried creating them via application.yaml but doesnt work , Any help is greatly appreciated.

          password: xyz
          username: admin
            name: xyz
            password: xyz
                max-endpoints: 5
                min-endpoints: 1000
            autoreleaseAfter: 20000

@deniswsrosa / @mreiche can you please assist ?

In your Configuration class, override the configureEnvironment bean.
Call the appropriate methods on the builder. https://docs.couchbase.com/java-sdk/current/ref/client-settings.html

	 * Can be overridden to customize the configuration of the environment before bootstrap.
	 * @param builder the builder that can be customized.
	protected void configureEnvironment(final ClusterEnvironment.Builder builder) {

Thanks a lot for your reply , I did see and try that but , the ClusterEnvironment class has the below 3 options to set

 private final JsonSerializer jsonSerializer;
  private final Transcoder transcoder;
  private final Optional<CryptoManager> cryptoManager;

and it extends CoreEnvironment that gives me the below options to set ,

private final UserAgent userAgent;
  private final Supplier<EventBus> eventBus;
  private final Timer timer;
  private final IoEnvironment ioEnvironment;
  private final IoConfig ioConfig;
  private final CompressionConfig compressionConfig;
  private final SecurityConfig securityConfig;
  private final TimeoutConfig timeoutConfig;
  private final OrphanReporterConfig orphanReporterConfig;
  private final ThresholdRequestTracerConfig thresholdRequestTracerConfig;
  private final Supplier<RequestTracer> requestTracer;
  private final LoggerConfig loggerConfig;
  private final RetryStrategy retryStrategy;
  private final Supplier<Scheduler> scheduler;
  private final OrphanReporter orphanReporter;
  private final long maxNumRequestsInRetry;

I could not find any QuerryConfig to be set here nor the autoreleaseAfter option , Could you please guide me as to how do I set these options using the ClusterEnvironment or the CoreEnvironment ?

And congrats on your anniversary here :slight_smile:

Here is an example of using QueryServiceConfig.

Thanks @mreiche , but the crux of the problem is that the class DefaultCouchbaseEnvironment is no more in version 2.4.1 , without this class how do I configure the QueryServiceConfig ?

Ok - I didn’t dig deep enough. Sorry.

In com.couchbase.client.core.node.Node.createService() the QuerySerivceConfig uses values from env.ioConfig() :

return new QueryService(QueryServiceConfig
          ctx, address, port

And those can be set by overriding configureEnvironment() of your Config class (that extends AbstractCouchbaseConfiguration) like:

public void  configureEnvironment(final ClusterEnvironment.Builder builder)  {
	return ;


Thanks a lot @mreiche , that solves it but have one question if we do not require the QueryServiceConfig , why do we have it for ? or is it still needed at some place ?