diff --git a/spring-data-mongodb/pom.xml b/spring-data-mongodb/pom.xml index 9087dbfbc7..b4abb56fd5 100644 --- a/spring-data-mongodb/pom.xml +++ b/spring-data-mongodb/pom.xml @@ -7,7 +7,6 @@ jar spring-data-mongodb - http://maven.apache.org UTF-8 @@ -18,8 +17,6 @@ 2.4.1 - - diff --git a/spring-data-mongodb/src/main/java/org/baeldung/config/MongoConfig.java b/spring-data-mongodb/src/main/java/org/baeldung/config/MongoConfig.java new file mode 100644 index 0000000000..9f9868d7d5 --- /dev/null +++ b/spring-data-mongodb/src/main/java/org/baeldung/config/MongoConfig.java @@ -0,0 +1,28 @@ +package org.baeldung.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.data.mongodb.config.AbstractMongoConfiguration; +import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; + +import com.mongodb.Mongo; +import com.mongodb.MongoClient; + +@Configuration +@EnableMongoRepositories +public class MongoConfig extends AbstractMongoConfiguration { + + @Override + protected String getDatabaseName() { + return "test"; + } + + @Override + public Mongo mongo() throws Exception { + return new MongoClient("127.0.0.1", 27017); + } + + @Override + protected String getMappingBasePackage() { + return "org.baeldung"; + } +}