Spring-data-couchbase 4.0.0 ,spring boot 2.3.0 and configure second bucket using couchbaseClientFactory

Upgrading to spring boot 2.3.0 the SDK 4.0.0 verison I am facing issues while configuring reactive template with second bucket.
I went through the API documentation and figured out have to configure separate couchbase client factory.

The  `CouchbaseClientFactory`  is the main way to get access to the managed SDK instance and resources.

Please note that a single factory is always bound to a  `Bucket` , so if you need to access more than one you need to initialize one factory for each.

So I created client factory instance with second bucket and used it as a parameter with

ReactiveCouchbaseTemplate(final CouchbaseClientFactory clientFactory, final CouchbaseConverter converter) {

What should be implementation for CouchbaseClientFactory ? Where do I need to configure second bucket name?
I tried this but its always connecting to second bucket then.

	public CouchbaseClientFactory couchbaseClientFactory(Cluster couchbaseCluster) {
		return new SimpleCouchbaseClientFactory(couchbaseCluster, env.getProperty("spring.couchbase.bucket.second.name"), getScopeName());
	}

Have configured reactiveCouchbaseRepositoryOperationsMapping and
configureReactiveRepositoryOperationsMapping also.

@Override
	@Bean(name = BeanNames.REACTIVE_COUCHBASE_OPERATIONS_MAPPING)
	public ReactiveRepositoryOperationsMapping reactiveCouchbaseRepositoryOperationsMapping(
			ReactiveCouchbaseTemplate reactiveCouchbaseTemplate) {
		// create a base mapping that associates all repositories to the default template
		ReactiveRepositoryOperationsMapping baseMapping = new ReactiveRepositoryOperationsMapping(
				reactiveCouchbaseTemplate);
		// let the user tune it
		configureReactiveRepositoryOperationsMapping(baseMapping);
		return baseMapping;
	}


@Override
	public void configureReactiveRepositoryOperationsMapping(ReactiveRepositoryOperationsMapping baseMapping) {
		try {
			baseMapping.mapEntity(Domain.class, 
					reactiveCouchbaseTemplate(couchbaseClientFactory(getCluster()),
							mappingCouchbaseConverter(
							couchbaseMappingContext(customConversions()),new CouchbaseCustomConversions(Collections.emptyList()))
							));
		} catch (Exception e) {
			// custom Exception handling
		}
	}

Need help on couchbaseClientFactory and reactive couchbase template for 4.0.0.

Your couchbaseClientFactory() method is not being used because there is a bean by the same name (I see this when I run in the debugger). Change the name to myCouchbaseClientFactory() and yours will be used.

Made the changes, on application startup it opens two buckets.
Can see below have mapped the entity class in base mapping .This repository should connect to second bucket.
But when I try to fetch data still its always connecting to first bucket and gives data not found exception.
Here’s my configuration class ( below code is working after making suggested changes)

/** Standard connection string and cluster connection details code goes here**/

    @Configuration
    @EnableReactiveCouchbaseRepositories(basePackages = "**.repository")
    public class CouchbaseConfig extends AbstractCouchbaseConfiguration {


public CouchbaseClientFactory couchbaseClientFactoryForContent() {
	return new SimpleCouchbaseClientFactory(getConnectionString(), authenticator(),
			env.getProperty("spring.couchbase.bucket.content.name"));
}


public ReactiveCouchbaseTemplate myReactiveCouchbaseTemplate(CouchbaseClientFactory couchbaseClientFactory,
		MappingCouchbaseConverter mappingCouchbaseConverter) {
	return new ReactiveCouchbaseTemplate(couchbaseClientFactory, mappingCouchbaseConverter);
}


@Override
@Bean(name = BeanNames.REACTIVE_COUCHBASE_OPERATIONS_MAPPING)
public ReactiveRepositoryOperationsMapping reactiveCouchbaseRepositoryOperationsMapping(
		ReactiveCouchbaseTemplate reactiveCouchbaseTemplate) {
	// create a base mapping that associates all repositories to the default
	// template
	ReactiveRepositoryOperationsMapping baseMapping = new ReactiveRepositoryOperationsMapping(
			reactiveCouchbaseTemplate(couchbaseClientFactory(couchbaseCluster(couchbaseClusterEnvironment())),
					new MappingCouchbaseConverter()));
	// let the user tune it
	configureReactiveRepositoryOperationsMapping(baseMapping);
	return baseMapping;
}


@Override
public void configureReactiveRepositoryOperationsMapping(ReactiveRepositoryOperationsMapping baseMapping) {
	try {
		baseMapping.mapEntity(Model.class,
				myReactiveCouchbaseTemplate(couchbaseClientFactoryForContent(), new MappingCouchbaseConverter()));
	} catch (Exception e) {
		// custom Exception handling
	}
    }


}

Not able to figure out what configuration I am missing.

You have the same type of issue as earlier, except with your reactiveCouchbaseTemplate() method. (instead of evaluating your method, the call is intercepted by the spring class enhancer, and uses the existing bean with that name.). Change the name of your method so that it gets called instead of the bean.

ReactiveCouchbaseTemplate template = myReactiveCouchbaseTemplate(couchbaseClientFactoryForContent(),new MappingCouchbaseConverter());

Thanks @mreiche that worked!!!
I created custom methods for both reactive template and client factory.
Able to connect and fetch data from both buckets.
Also have update the working code in same code snippet above.

Glad you got it working. The spring class-enhancer intercepting method calls was a learning experience for me, too.