in my project I have a Couchbase cluster. I also have different buckets for different datas. I want to configure them in CouchbaseConfiguration file as it is specified inDocumentation but I got NullPointerException.
I am using spring-data-couchbase in pom.xml
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-couchbase</artifactId>
<version>4.2.5</version>
</dependency>
And this is my CouchbaseConfiguration file.
package com.example.cbase.configuration;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.Cluster;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration;
@Configuration
public class CouchbaseConfiguration extends AbstractCouchbaseConfiguration {
@Override
public String getConnectionString() {
return "10.10.56.12,10.10.56.13,10.10.56.14";
}
@Override
public String getUserName() {
return "user1";
}
@Override
public String getPassword() {
return "password1!";
}
@Override
public String getBucketName() {
return null;
}
@Bean
public Bucket testCaseBucket(Cluster cluster) {
return cluster.bucket("testCaseBucket");
}
@Bean
public Bucket testRunBucket(Cluster cluster) {
return cluster.bucket("testRunBucket");
}
@Bean
public Bucket userLogBucket(Cluster cluster) {
return cluster.bucket("userLogBucket");
}
@Bean
public Bucket scheduleBucket(Cluster cluster) {
return cluster.bucket("scheduleBucket");
}
}