@Configuration @ConditionalOnClass(value={com.mongodb.Mongo.class,org.springframework.data.mongodb.core.MongoTemplate.class}) @EnableConfigurationProperties(value=MongoProperties.class) public class MongoDataAutoConfiguration extends Object implements BeanClassLoaderAware
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,
Environment environment,
ResourceLoader resourceLoader) |
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,
BeanFactory beanFactory) |
org.springframework.data.mongodb.core.SimpleMongoDbFactory |
mongoDbFactory(com.mongodb.MongoClient mongo) |
org.springframework.data.mongodb.core.mapping.MongoMappingContext |
mongoMappingContext(BeanFactory beanFactory) |
org.springframework.data.mongodb.core.MongoTemplate |
mongoTemplate(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory,
org.springframework.data.mongodb.core.convert.MongoConverter converter) |
void |
setBeanClassLoader(ClassLoader classLoader) |
public MongoDataAutoConfiguration(MongoProperties properties, Environment environment, ResourceLoader resourceLoader)
public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
@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, BeanFactory beanFactory)
@Bean @ConditionalOnMissingBean public org.springframework.data.mongodb.core.mapping.MongoMappingContext mongoMappingContext(BeanFactory beanFactory) 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)
Copyright © 2016 Pivotal Software, Inc.. All rights reserved.