DATACOUCH-192 - Prefix all bean names with "couchbase"
This commit is contained in:
@@ -165,7 +165,7 @@ public abstract class AbstractCouchbaseConfiguration {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Bean(name = BeanNames.REPO_OPERATIONS_MAPPING)
|
||||
@Bean(name = BeanNames.COUCHBASE_OPERATIONS_MAPPING)
|
||||
public RepositoryOperationsMapping repositoryOperationsMapping() throws Exception {
|
||||
//create a base mapping that associates all repositories to the default template
|
||||
RepositoryOperationsMapping baseMapping = new RepositoryOperationsMapping(couchbaseTemplate());
|
||||
@@ -201,7 +201,7 @@ public abstract class AbstractCouchbaseConfiguration {
|
||||
*
|
||||
* @throws Exception on Bean construction failure.
|
||||
*/
|
||||
@Bean
|
||||
@Bean(name = BeanNames.COUCHBASE_MAPPING_CONVERTER)
|
||||
public MappingCouchbaseConverter mappingCouchbaseConverter() throws Exception {
|
||||
MappingCouchbaseConverter converter = new MappingCouchbaseConverter(couchbaseMappingContext(), typeKey());
|
||||
converter.setCustomConversions(customConversions());
|
||||
@@ -213,7 +213,7 @@ public abstract class AbstractCouchbaseConfiguration {
|
||||
*
|
||||
* @return TranslationService, defaulting to JacksonTranslationService.
|
||||
*/
|
||||
@Bean
|
||||
@Bean(name = BeanNames.COUCHBASE_TRANSLATION_SERVICE)
|
||||
public TranslationService translationService() {
|
||||
final JacksonTranslationService jacksonTranslationService = new JacksonTranslationService();
|
||||
jacksonTranslationService.afterPropertiesSet();
|
||||
@@ -225,7 +225,7 @@ public abstract class AbstractCouchbaseConfiguration {
|
||||
*
|
||||
* @throws Exception on Bean construction failure.
|
||||
*/
|
||||
@Bean
|
||||
@Bean(name = BeanNames.COUCHBASE_MAPPING_CONTEXT)
|
||||
public CouchbaseMappingContext couchbaseMappingContext() throws Exception {
|
||||
CouchbaseMappingContext mappingContext = new CouchbaseMappingContext();
|
||||
mappingContext.setInitialEntitySet(getInitialEntitySet());
|
||||
@@ -241,7 +241,7 @@ public abstract class AbstractCouchbaseConfiguration {
|
||||
*
|
||||
* @return must not be {@literal null}.
|
||||
*/
|
||||
@Bean
|
||||
@Bean(name = BeanNames.COUCHBASE_CUSTOM_CONVERSIONS)
|
||||
public CustomConversions customConversions() {
|
||||
return new CustomConversions(Collections.emptyList());
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.data.couchbase.config;
|
||||
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
/**
|
||||
* Contains default bean names that will be used when no "id" is supplied to the beans.
|
||||
*
|
||||
@@ -46,7 +48,7 @@ public class BeanNames {
|
||||
/**
|
||||
* Refers to the "<couchbase:translation-service />" bean
|
||||
*/
|
||||
static final String TRANSLATION_SERVICE = "couchbaseTranslationService";
|
||||
static final String COUCHBASE_TRANSLATION_SERVICE = "couchbaseTranslationService";
|
||||
|
||||
/**
|
||||
* Refers to the "<couchbase:clusterInfo>" bean
|
||||
@@ -56,10 +58,25 @@ public class BeanNames {
|
||||
/**
|
||||
* The bean that stores custom mapping between repositories and their backing couchbaseOperations.
|
||||
*/
|
||||
public static final String REPO_OPERATIONS_MAPPING = "repositoryOperationsMapping";
|
||||
public static final String COUCHBASE_OPERATIONS_MAPPING = "couchbaseRepositoryOperationsMapping";
|
||||
|
||||
/**
|
||||
* The bean that drives how some indexes are automatically created.
|
||||
*/
|
||||
public static final String COUCHBASE_INDEX_MANAGER = "couchbaseIndexManager";
|
||||
|
||||
/**
|
||||
* The bean that performs conversion to/from representation suitable for storage in couchbase.
|
||||
*/
|
||||
public static final String COUCHBASE_MAPPING_CONVERTER = "couchbaseMappingConverter";
|
||||
|
||||
/**
|
||||
* The bean that stores mapping metadata for entities stored in couchbase.
|
||||
*/
|
||||
public static final String COUCHBASE_MAPPING_CONTEXT = "couchbaseMappingContext";
|
||||
|
||||
/**
|
||||
* The bean that registers custom {@link Converter Converters} to encode/decode entity members.
|
||||
*/
|
||||
public static final String COUCHBASE_CUSTOM_CONVERSIONS = "couchbaseCustomConversions";
|
||||
}
|
||||
|
||||
@@ -67,12 +67,12 @@ public class CouchbaseTranslationServiceParser extends AbstractSingleBeanDefinit
|
||||
* @param element the XML element which contains the attributes.
|
||||
* @param definition the bean definition to work with.
|
||||
* @param parserContext encapsulates the parsing state and configuration.
|
||||
* @return the ID to work with (e.g., "translationService")
|
||||
* @return the ID to work with (e.g., "couchbaseTranslationService")
|
||||
*/
|
||||
@Override
|
||||
protected String resolveId(final Element element, final AbstractBeanDefinition definition, final ParserContext parserContext) {
|
||||
String id = super.resolveId(element, definition, parserContext);
|
||||
return StringUtils.hasText(id) ? id : BeanNames.TRANSLATION_SERVICE;
|
||||
return StringUtils.hasText(id) ? id : BeanNames.COUCHBASE_TRANSLATION_SERVICE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,9 +55,9 @@ public class CouchbaseRepositoryConfigurationExtension extends RepositoryConfigu
|
||||
|
||||
@Override
|
||||
public void postProcess(final BeanDefinitionBuilder builder, final AnnotationRepositoryConfigurationSource config) {
|
||||
builder.addDependsOn(BeanNames.REPO_OPERATIONS_MAPPING);
|
||||
builder.addDependsOn(BeanNames.COUCHBASE_OPERATIONS_MAPPING);
|
||||
builder.addDependsOn(BeanNames.COUCHBASE_INDEX_MANAGER);
|
||||
builder.addPropertyReference("couchbaseOperationsMapping", BeanNames.REPO_OPERATIONS_MAPPING);
|
||||
builder.addPropertyReference("couchbaseOperationsMapping", BeanNames.COUCHBASE_OPERATIONS_MAPPING);
|
||||
builder.addPropertyReference("indexManager", BeanNames.COUCHBASE_INDEX_MANAGER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ The reference to a CouchbaseConverter instance.
|
||||
<xsd:attribute name="translation-service-ref" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The reference to the Translation Service (by default "translationService").]]>
|
||||
The reference to the Translation Service (by default "couchbaseTranslationService").]]>
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
@@ -132,7 +132,7 @@ The reference to a CouchbaseConverter instance.
|
||||
<xsd:attribute name="id" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The id of the translation-service definition (by default "translationService").]]></xsd:documentation>
|
||||
The id of the translation-service definition (by default "couchbaseTranslationService").]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="objectMapper" type="xsd:string" use="optional">
|
||||
|
||||
Reference in New Issue
Block a user