@Configuration(proxyBeanMethods=false) public abstract class AbstractMongoClientConfiguration extends MongoConfigurationSupport
MongoClient
.MongoConfigurationSupport
Constructor and Description |
---|
AbstractMongoClientConfiguration() |
abbreviateFieldNames, autoIndexCreation, configureClientSettings, configureConverters, customConversions, fieldNamingStrategy, getDatabaseName, getInitialEntitySet, getMappingBasePackages, mongoClientSettings, mongoMappingContext, scanForEntities
public com.mongodb.client.MongoClient mongoClient()
MongoClient
instance to connect to. Annotate with Bean
in case you want to expose a
MongoClient
instance to the ApplicationContext
. MongoConfigurationSupport.mongoClientSettings()
to configure connection details.MongoConfigurationSupport.mongoClientSettings()
,
#configureClientSettings(Builder)
@Bean public MongoTemplate mongoTemplate(MongoDatabaseFactory databaseFactory, MappingMongoConverter converter)
MongoTemplate
.@Bean public MongoDatabaseFactory mongoDbFactory()
SimpleMongoClientDatabaseFactory
to be used by the
MongoTemplate
. Will use the MongoClient
instance configured in mongoClient()
.@Deprecated @Nullable protected String getMappingBasePackage()
MongoConfigurationSupport.getMappingBasePackages()
instead.Document
s. Will return the package name of the configuration
class' (the concrete class, not this one here) by default. So if you have a com.acme.AppConfig
extending
AbstractMongoClientConfiguration
the base package will be considered com.acme
unless the method is
overridden to implement alternate behavior.Document
classes or null to not enable scanning for
entities.@Bean public MappingMongoConverter mappingMongoConverter(MongoDatabaseFactory databaseFactory, MongoCustomConversions customConversions, MongoMappingContext mappingContext)
MappingMongoConverter
using the configured mongoDbFactory()
and
MongoConfigurationSupport.mongoMappingContext(MongoCustomConversions)
. Will get MongoConfigurationSupport.customConversions()
applied.protected com.mongodb.client.MongoClient createMongoClient(com.mongodb.MongoClientSettings settings)
MongoClient
instance with given
MongoClientSettings
.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.