Best practice to open couchbase cluster and bucket

Are there any best practices on how to open couchbase cluster and bucket?
Currently we opening cluster and bucket in application startup:

CouchbaseEnvironment environment =
Cluster cluster = CouchbaseCluster.create(environment, this.couchbaseConfig.getUrl());
cluster.authenticate(this.couchbaseConfig.getUsername(), this.couchbaseConfig.getPassword());  
Bucket bucket = cluster.openBucket(bucketName);

But when the couchbase server is stopped and started, it attempts to reconnect with the endpoint and searches for the bucket. It successfully finds the bucket and gets connected to it and we also receive logs which indicate that the bucket has been connected to. All of this happens automatically on its own.
Now, the problem we are facing is, even after the connection to bucket is established and the bucket has opened, when any of the service endpoint is hit, it is not able to perform any couchbase operations.
So the problem is with the cluster and not the bucket connection. Is there any best practice to open bucket and cluster on startup of the application so that the services need not be restarted every time the couchbase server is down and up again?

@Madhumitha I think what you are describing should work. Can you please share the logs so we can investigate what is going on?

@daschl I have attached the logs that we received in this query: Couchbase operations are failing after couchbase server is restarted
I have also attached a sample application that you can use to run and check the behaviour that we are getting. I have added an endpoint with @GetMapping("/data/{dataId}") and I have attached all the necessary instruction to make it run in the file. This endpoint hits the couchbase and returns expected result. It works until we restart the couchbase or stop and start the server. But right after the server starts after stopping, we are getting timeout errors and we are not able to perform any operations to the couchbase.
I used a couchbase docker image and i started the couchbase and checked. Then I stopped the container, and then again I started it. So now is when its not working. In environment, there are scenarios in which the couchbase server is down for a minute or two for maintenance. So, we will be facing such scenarios there too. I tried to replicate it locally. (76.2 KB)

@daschl any idea why this happens?