Multiple couchbase cluster configuration in single springboot project

79 Views Asked by At

I have been trying to configure 2 different couchbase cluster(not bucket) by extending AbstractCouchbaseConfiguration abstract class as follow:

@Configuration
@EnableCouchbaseRepositories("com.stack.xyz")
public class CouchbaseConfig extends AbstractCouchbaseConfiguration {

    @Override
    public String getConnectionString() {
        return "abc";
    }

    @Override
    public String getUserName() {
        return "def";
    }

    @Override
    public String getPassword() {
        return "ghi";
    }

    @Override
    public String getBucketName() {
        return "jkl";
    }
}

in same way other as: 

@Configuration
@EnableCouchbaseRepositories("com.stack.lmo")
public class CouchbaseConfig extends AbstractCouchbaseConfiguration {...}

**Problem is though my repository classes is not inside "com.stack.lmo" as well as "com.stack.xyz" packages, repositories are getting scanned and saved into couchbase, then whats the meaning of this annotation?

Can anyone help how can I efficiently configure my clusters.

I have gone through the documentation but didn't find anything related to this.**

1

There are 1 best solutions below

0
mn_test347 On

Use the example here - https://github.com/spring-projects/spring-data-couchbase/issues/878

You'll need to supply a different getConnectionString() and authenticator() for myCouchbaseClientFactory()