uk.co.caeldev.spring.moprhia.MongoConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-morphia Show documentation
Show all versions of spring-morphia Show documentation
A Commons Library to provide moprhia configuration
package uk.co.caeldev.spring.moprhia;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableConfigurationProperties(MongoSettings.class)
@ConditionalOnProperty({
"mongo.servers[0].name",
"mongo.servers[0].port",
"mongo.database",
"mongo.username",
"mongo.password"})
public class MongoConfiguration {
@Bean
public MongoServer mongoServer() {
return new MongoServer();
}
@Bean
public MongoSettings mongoSettings() {
return new MongoSettings();
}
}