Skip to content

Commit 415d339

Browse files
jorgerodmikereiche
authored andcommitted
Restore feature 'Inject translation service bean in CouchbaseTemplateSupport'.
The feature was accidentally removed when DATACOUCH-550 was reverted. Closes #1140.
1 parent 42b7fb3 commit 415d339

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/main/java/org/springframework/data/couchbase/config/AbstractCouchbaseConfiguration.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
* @author Simon Baslé
7171
* @author Stephane Nicoll
7272
* @author Subhashni Balakrishnan
73+
* @author Jorge Rodriguez Martin
7374
*/
7475
@Configuration
7576
public abstract class AbstractCouchbaseConfiguration {
@@ -158,15 +159,27 @@ protected void configureEnvironment(final ClusterEnvironment.Builder builder) {
158159
}
159160

160161
@Bean(name = BeanNames.COUCHBASE_TEMPLATE)
162+
public CouchbaseTemplate couchbaseTemplate(CouchbaseClientFactory couchbaseClientFactory,
163+
MappingCouchbaseConverter mappingCouchbaseConverter, TranslationService couchbaseTranslationService) {
164+
return new CouchbaseTemplate(couchbaseClientFactory, mappingCouchbaseConverter, couchbaseTranslationService);
165+
}
166+
161167
public CouchbaseTemplate couchbaseTemplate(CouchbaseClientFactory couchbaseClientFactory,
162168
MappingCouchbaseConverter mappingCouchbaseConverter) {
163-
return new CouchbaseTemplate(couchbaseClientFactory, mappingCouchbaseConverter);
169+
return couchbaseTemplate(couchbaseClientFactory, mappingCouchbaseConverter, new JacksonTranslationService());
164170
}
165171

166172
@Bean(name = BeanNames.REACTIVE_COUCHBASE_TEMPLATE)
173+
public ReactiveCouchbaseTemplate reactiveCouchbaseTemplate(CouchbaseClientFactory couchbaseClientFactory,
174+
MappingCouchbaseConverter mappingCouchbaseConverter, TranslationService couchbaseTranslationService) {
175+
return new ReactiveCouchbaseTemplate(couchbaseClientFactory, mappingCouchbaseConverter,
176+
couchbaseTranslationService);
177+
}
178+
167179
public ReactiveCouchbaseTemplate reactiveCouchbaseTemplate(CouchbaseClientFactory couchbaseClientFactory,
168180
MappingCouchbaseConverter mappingCouchbaseConverter) {
169-
return new ReactiveCouchbaseTemplate(couchbaseClientFactory, mappingCouchbaseConverter);
181+
return reactiveCouchbaseTemplate(couchbaseClientFactory, mappingCouchbaseConverter,
182+
new JacksonTranslationService());
170183
}
171184

172185
@Bean(name = BeanNames.COUCHBASE_OPERATIONS_MAPPING)

0 commit comments

Comments
 (0)