@Configuration @ConditionalOnClass(value={com.mongodb.MongoClient.class,org.springframework.data.mongodb.core.MongoTemplate.class}) @EnableConfigurationProperties(value=MongoProperties.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(org.springframework.context.ApplicationContext applicationContext,
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.beans.factory.BeanFactory beanFactory,
org.springframework.data.mongodb.core.convert.CustomConversions conversions) |
org.springframework.data.mongodb.core.convert.CustomConversions |
mongoCustomConversions() |
org.springframework.data.mongodb.core.SimpleMongoDbFactory |
mongoDbFactory(com.mongodb.MongoClient mongo) |
org.springframework.data.mongodb.core.mapping.MongoMappingContext |
mongoMappingContext(org.springframework.beans.factory.BeanFactory beanFactory,
org.springframework.data.mongodb.core.convert.CustomConversions conversions) |
org.springframework.data.mongodb.core.MongoTemplate |
mongoTemplate(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory,
org.springframework.data.mongodb.core.convert.MongoConverter converter) |
public MongoDataAutoConfiguration(org.springframework.context.ApplicationContext applicationContext, MongoProperties properties)
@Bean @ConditionalOnMissingBean(value=org.springframework.data.mongodb.MongoDbFactory.class) public org.springframework.data.mongodb.core.SimpleMongoDbFactory mongoDbFactory(com.mongodb.MongoClient mongo) throws Exception
Exception
@Bean @ConditionalOnMissingBean public org.springframework.data.mongodb.core.MongoTemplate mongoTemplate(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory, org.springframework.data.mongodb.core.convert.MongoConverter converter) throws UnknownHostException
UnknownHostException
@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.beans.factory.BeanFactory beanFactory, org.springframework.data.mongodb.core.convert.CustomConversions conversions)
@Bean @ConditionalOnMissingBean public org.springframework.data.mongodb.core.mapping.MongoMappingContext mongoMappingContext(org.springframework.beans.factory.BeanFactory beanFactory, org.springframework.data.mongodb.core.convert.CustomConversions conversions) throws ClassNotFoundException
ClassNotFoundException
@Bean @ConditionalOnMissingBean public org.springframework.data.mongodb.gridfs.GridFsTemplate gridFsTemplate(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory, org.springframework.data.mongodb.core.MongoTemplate mongoTemplate)
@Bean @ConditionalOnMissingBean public org.springframework.data.mongodb.core.convert.CustomConversions mongoCustomConversions()
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.