|
Spring Data Document | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.data.mongodb.config.AbstractMongoConfiguration
@Configuration public abstract class AbstractMongoConfiguration
Base class for Spring Data Mongo configuration using JavaConfig.
Constructor Summary | |
---|---|
AbstractMongoConfiguration()
|
Method Summary | |
---|---|
CustomConversions |
customConversions()
Register custom Converter s in a CustomConversions object if required. |
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 String |
getMappingBasePackage()
Return the base package to scan for mapped Document s. |
protected org.springframework.data.authentication.UserCredentials |
getUserCredentials()
Return UserCredentials to be used when connecting to the MongoDB instance or null if none shall
be used. |
MappingMongoConverter |
mappingMongoConverter()
Creates a MappingMongoConverter using the configured mongoDbFactory() and
mongoMappingContext() . |
abstract Mongo |
mongo()
Return the Mongo instance to connect to. |
SimpleMongoDbFactory |
mongoDbFactory()
Creates a SimpleMongoDbFactory to be used by the MongoTemplate . |
MongoMappingContext |
mongoMappingContext()
Creates a MongoMappingContext equipped with entity classes scanned from the mapping base package. |
MongoTemplate |
mongoTemplate()
Creates a MongoTemplate . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractMongoConfiguration()
Method Detail |
---|
protected abstract String getDatabaseName()
@Bean public abstract Mongo mongo() throws Exception
Mongo
instance to connect to.
Exception
@Bean public MongoTemplate mongoTemplate() throws Exception
MongoTemplate
.
Exception
@Bean public SimpleMongoDbFactory mongoDbFactory() throws Exception
SimpleMongoDbFactory
to be used by the MongoTemplate
. Will use the Mongo
instance
configured in mongo()
.
Exception
mongo()
,
mongoTemplate()
protected String getMappingBasePackage()
Document
s.
protected org.springframework.data.authentication.UserCredentials getUserCredentials()
UserCredentials
to be used when connecting to the MongoDB instance or null if none shall
be used.
@Bean public MongoMappingContext mongoMappingContext() throws ClassNotFoundException
MongoMappingContext
equipped with entity classes scanned from the mapping base package.
ClassNotFoundException
getMappingBasePackage()
@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 CustomConversions
instance by default.
@Bean public MappingMongoConverter mappingMongoConverter() throws Exception
MappingMongoConverter
using the configured mongoDbFactory()
and
mongoMappingContext()
. Will get customConversions()
applied.
Exception
customConversions()
,
mongoMappingContext()
,
mongoDbFactory()
protected Set<Class<?>> getInitialEntitySet() throws ClassNotFoundException
Document
.
ClassNotFoundException
getMappingBasePackage()
|
Spring Data Document | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |