public abstract class MongoConfigurationSupport extends Object
Constructor and Description |
---|
MongoConfigurationSupport() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
abbreviateFieldNames()
Configures whether to abbreviate field names for domain objects by configuring a
CamelCaseAbbreviatingFieldNamingStrategy on the MongoMappingContext instance created. |
protected boolean |
autoIndexCreation()
Configure whether to automatically create indices for domain types by deriving the
IndexDefinition from the entity or not. |
CustomConversions |
customConversions()
Register custom
Converter s in a CustomConversions object if required. |
protected FieldNamingStrategy |
fieldNamingStrategy()
Configures a
FieldNamingStrategy on the MongoMappingContext instance created. |
protected abstract String |
getDatabaseName()
Return the name of the database to connect to.
|
protected Set<Class<?>> |
getInitialEntitySet()
Scans the mapping base package for classes annotated with
Document . |
protected Collection<String> |
getMappingBasePackages()
Returns the base packages to scan for MongoDB mapped entities at startup.
|
MongoMappingContext |
mongoMappingContext()
Creates a
MongoMappingContext equipped with entity classes scanned from the mapping base package. |
protected Set<Class<?>> |
scanForEntities(String basePackage)
Scans the given base package for entities, i.e.
|
protected abstract String getDatabaseName()
protected Collection<String> getMappingBasePackages()
com.acme.AppConfig
extending MongoConfigurationSupport
the base package will be considered
com.acme
unless the method is overridden to implement alternate behavior.Document
classes or an empty collection to not enable scanning
for entities.@Bean public MongoMappingContext mongoMappingContext() throws ClassNotFoundException
MongoMappingContext
equipped with entity classes scanned from the mapping base package.ClassNotFoundException
getMappingBasePackages()
@Bean public CustomConversions customConversions()
Converter
s in a CustomConversions
object if required. These
CustomConversions
will be registered with the #mappingMongoConverter()
and
MongoMappingContext
. Returns an empty MongoCustomConversions
instance by default.protected Set<Class<?>> getInitialEntitySet() throws ClassNotFoundException
Document
. By default, it scans for entities in
all packages returned by getMappingBasePackages()
.ClassNotFoundException
getMappingBasePackages()
protected Set<Class<?>> scanForEntities(String basePackage) throws ClassNotFoundException
Document
and
Persistent
.basePackage
- must not be null.ClassNotFoundException
protected boolean abbreviateFieldNames()
CamelCaseAbbreviatingFieldNamingStrategy
on the MongoMappingContext
instance created. For advanced
customization needs, consider overriding #mappingMongoConverter()
.protected FieldNamingStrategy fieldNamingStrategy()
FieldNamingStrategy
on the MongoMappingContext
instance created.protected boolean autoIndexCreation()
IndexDefinition
from the entity or not.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.