4

Spring Data - Document documentation gives and example of configuring a factory bean for creating MongoDB connections using mongo:db-factory element.

<mongo:db-factory id="anotherMongoDbFactory"
              host="localhost"
              port="27017"
              dbname="database"
              username="joe"
              password="secret"/>

The problem is that the XSD for the mongo namespace does not declare a db-factory element. Is this a bug or am I looking at incorrect version of documentation?

Tahir Akhtar
  • 11,385
  • 7
  • 42
  • 69

1 Answers1

2

The mongo:db-factory element is available from Spring-Data 1.0 Milestone 3. The package can be downloaded from here and the documentation can be found at Spring-Data 1.0.0.M3 Documentation.

To use it from Maven, just include the following dependency in the pom.xml file:

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-mongodb</artifactId>
    <version>1.0.0.M3</version>
</dependency> 

Probably you were using the 1.0.0.M2 version of the code (Spring-Data 1.0.0.M2 Documentation) where the db-factory was not yet available in the XSD or the online documentation.

edrabc
  • 1,259
  • 1
  • 14
  • 23