@Configuration @ConditionalOnClass(value={com.mongodb.MongoClient.class,com.mongodb.client.MongoClient.class,org.springframework.data.mongodb.core.MongoTemplate.class}) @Conditional(value=org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration.AnyMongoClientAvailable.class) @EnableConfigurationProperties(value=MongoProperties.class) @Import(value=org.springframework.boot.autoconfigure.data.mongo.MongoDataConfiguration.class) @AutoConfigureAfter(value=MongoAutoConfiguration.class) public class MongoDataAutoConfiguration extends Object
Auto-configuration
for Spring Data's mongo support.
Registers a MongoTemplate
and GridFsTemplate
beans if no other beans of
the same type are configured.
Honors the spring.data.mongodb.database property if set, otherwise connects to the test database.
Constructor and Description |
---|
MongoDataAutoConfiguration(MongoProperties properties) |
Modifier and Type | Method and Description |
---|---|
org.springframework.data.mongodb.gridfs.GridFsTemplate |
gridFsTemplate(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory,
org.springframework.data.mongodb.core.MongoTemplate mongoTemplate) |
org.springframework.data.mongodb.core.convert.MappingMongoConverter |
mappingMongoConverter(org.springframework.data.mongodb.MongoDbFactory factory,
org.springframework.data.mongodb.core.mapping.MongoMappingContext context,
org.springframework.data.mongodb.core.convert.MongoCustomConversions conversions) |
org.springframework.data.mongodb.core.MongoDbFactorySupport<?> |
mongoDbFactory(ObjectProvider<com.mongodb.MongoClient> mongo,
ObjectProvider<com.mongodb.client.MongoClient> mongoClient) |
org.springframework.data.mongodb.core.MongoTemplate |
mongoTemplate(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory,
org.springframework.data.mongodb.core.convert.MongoConverter converter) |
public MongoDataAutoConfiguration(MongoProperties properties)
@Bean @ConditionalOnMissingBean(value=org.springframework.data.mongodb.MongoDbFactory.class) public org.springframework.data.mongodb.core.MongoDbFactorySupport<?> mongoDbFactory(ObjectProvider<com.mongodb.MongoClient> mongo, ObjectProvider<com.mongodb.client.MongoClient> mongoClient)
@Bean @ConditionalOnMissingBean public org.springframework.data.mongodb.core.MongoTemplate mongoTemplate(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory, org.springframework.data.mongodb.core.convert.MongoConverter converter)
@Bean @ConditionalOnMissingBean(value=org.springframework.data.mongodb.core.convert.MongoConverter.class) public org.springframework.data.mongodb.core.convert.MappingMongoConverter mappingMongoConverter(org.springframework.data.mongodb.MongoDbFactory factory, org.springframework.data.mongodb.core.mapping.MongoMappingContext context, org.springframework.data.mongodb.core.convert.MongoCustomConversions conversions)
@Bean @ConditionalOnMissingBean public org.springframework.data.mongodb.gridfs.GridFsTemplate gridFsTemplate(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory, org.springframework.data.mongodb.core.MongoTemplate mongoTemplate)
Copyright © 2019 Pivotal Software, Inc.. All rights reserved.