23
23
import java .util .HashSet ;
24
24
import java .util .Set ;
25
25
26
- import com .couchbase .client .java .query .QueryScanConsistency ;
27
26
import org .springframework .beans .factory .config .BeanDefinition ;
28
27
import org .springframework .context .annotation .Bean ;
29
28
import org .springframework .context .annotation .ClassPathScanningCandidateComponentProvider ;
67
66
import com .couchbase .client .java .env .ClusterEnvironment ;
68
67
import com .couchbase .client .java .json .JacksonTransformers ;
69
68
import com .couchbase .client .java .json .JsonValueModule ;
69
+ import com .couchbase .client .java .query .QueryScanConsistency ;
70
70
import com .fasterxml .jackson .databind .ObjectMapper ;
71
71
72
72
/**
@@ -136,17 +136,11 @@ protected Authenticator authenticator() {
136
136
public CouchbaseClientFactory couchbaseClientFactory (final Cluster couchbaseCluster ) {
137
137
return new SimpleCouchbaseClientFactory (couchbaseCluster , getBucketName (), getScopeName ());
138
138
}
139
- /*
140
- @Bean
141
- public ReactiveCouchbaseClientFactory reactiveCouchbaseClientFactory(final Cluster couchbaseCluster) {
142
- return new SimpleReactiveCouchbaseClientFactory(couchbaseCluster, getBucketName(), getScopeName());
143
- }
144
- */
139
+
145
140
@ Bean (destroyMethod = "disconnect" )
146
141
public Cluster couchbaseCluster (ClusterEnvironment couchbaseClusterEnvironment ) {
147
- Cluster c = Cluster .connect (getConnectionString (),
142
+ return Cluster .connect (getConnectionString (),
148
143
clusterOptions (authenticator ()).environment (couchbaseClusterEnvironment ));
149
- return c ;
150
144
}
151
145
152
146
@ Bean (destroyMethod = "shutdown" )
@@ -171,29 +165,24 @@ protected void configureEnvironment(final ClusterEnvironment.Builder builder) {
171
165
172
166
@ Bean (name = BeanNames .COUCHBASE_TEMPLATE )
173
167
public CouchbaseTemplate couchbaseTemplate (CouchbaseClientFactory couchbaseClientFactory ,
174
- MappingCouchbaseConverter mappingCouchbaseConverter , TranslationService couchbaseTranslationService ) {
175
- return new CouchbaseTemplate (couchbaseClientFactory ,
176
- mappingCouchbaseConverter ,
177
- couchbaseTranslationService , getDefaultConsistency ());
168
+ MappingCouchbaseConverter mappingCouchbaseConverter , TranslationService couchbaseTranslationService ) {
169
+ return new CouchbaseTemplate (couchbaseClientFactory , mappingCouchbaseConverter , couchbaseTranslationService ,
170
+ getDefaultConsistency ());
178
171
}
179
172
180
173
public CouchbaseTemplate couchbaseTemplate (CouchbaseClientFactory couchbaseClientFactory ,
181
- MappingCouchbaseConverter mappingCouchbaseConverter ) {
182
- return couchbaseTemplate (couchbaseClientFactory ,
183
- mappingCouchbaseConverter ,
184
- new JacksonTranslationService ());
174
+ MappingCouchbaseConverter mappingCouchbaseConverter ) {
175
+ return couchbaseTemplate (couchbaseClientFactory , mappingCouchbaseConverter , new JacksonTranslationService ());
185
176
}
186
177
187
178
@ Bean (name = BeanNames .REACTIVE_COUCHBASE_TEMPLATE )
188
- public ReactiveCouchbaseTemplate reactiveCouchbaseTemplate (
189
- CouchbaseClientFactory couchbaseClientFactory ,
179
+ public ReactiveCouchbaseTemplate reactiveCouchbaseTemplate (CouchbaseClientFactory couchbaseClientFactory ,
190
180
MappingCouchbaseConverter mappingCouchbaseConverter , TranslationService couchbaseTranslationService ) {
191
- return new ReactiveCouchbaseTemplate (couchbaseClientFactory , mappingCouchbaseConverter ,
192
- couchbaseTranslationService , getDefaultConsistency ());
181
+ return new ReactiveCouchbaseTemplate (couchbaseClientFactory , mappingCouchbaseConverter , couchbaseTranslationService ,
182
+ getDefaultConsistency ());
193
183
}
194
184
195
- public ReactiveCouchbaseTemplate reactiveCouchbaseTemplate (
196
- CouchbaseClientFactory couchbaseClientFactory ,
185
+ public ReactiveCouchbaseTemplate reactiveCouchbaseTemplate (CouchbaseClientFactory couchbaseClientFactory ,
197
186
MappingCouchbaseConverter mappingCouchbaseConverter ) {
198
187
return reactiveCouchbaseTemplate (couchbaseClientFactory , mappingCouchbaseConverter ,
199
188
new JacksonTranslationService ());
@@ -358,7 +347,8 @@ public CouchbaseTransactionalOperator transactionalOperator(
358
347
@ Role (BeanDefinition .ROLE_INFRASTRUCTURE )
359
348
public TransactionInterceptor transactionInterceptor (TransactionManager couchbaseTransactionManager ) {
360
349
TransactionAttributeSource transactionAttributeSource = new AnnotationTransactionAttributeSource ();
361
- TransactionInterceptor interceptor = new CouchbaseTransactionInterceptor (couchbaseTransactionManager , transactionAttributeSource );
350
+ TransactionInterceptor interceptor = new CouchbaseTransactionInterceptor (couchbaseTransactionManager ,
351
+ transactionAttributeSource );
362
352
interceptor .setTransactionAttributeSource (transactionAttributeSource );
363
353
if (couchbaseTransactionManager != null ) {
364
354
interceptor .setTransactionManager (couchbaseTransactionManager );
0 commit comments