@Configuration @ConditionalOnClass(value={com.mongodb.MongoClient.class,org.springframework.data.mongodb.core.MongoTemplate.class}) @ConditionalOnBean(value=com.mongodb.MongoClient.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.SimpleMongoDbFactory |
mongoDbFactory(com.mongodb.MongoClient mongo) |
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.SimpleMongoDbFactory mongoDbFactory(com.mongodb.MongoClient mongo)
@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 © 2018 Pivotal Software, Inc.. All rights reserved.