@ -107,15 +107,14 @@
< dependency>
< dependency>
< groupId> org.springframework.data< /groupId>
< groupId> org.springframework.data< /groupId>
< artifactId> spring-data-mongodb< /artifactId>
< artifactId> spring-data-mongodb< /artifactId>
< version> 1.0.0.M5 < /version>
< version> 1.1.0.RELEASE < /version>
< /dependency>
< /dependency>
< /dependencies>
< /dependencies> </programlisting>
</programlisting>
<para > Also change the version of Spring in the pom.xml to be</para>
<para > Also change the version of Spring in the pom.xml to be</para>
<programlisting lang= "" language= "xml" > < spring.framework.version> 3.0.6 .RELEASE< /spring.framework.version> </programlisting>
<programlisting lang= "" language= "xml" > < spring.framework.version> 3.1.2 .RELEASE< /spring.framework.version> </programlisting>
<para > You will also need to add the location of the Spring Milestone
<para > You will also need to add the location of the Spring Milestone
repository for maven to your pom.xml which is at the same level of your
repository for maven to your pom.xml which is at the same level of your
@ -125,7 +124,7 @@
< repository>
< repository>
< id> spring-milestone< /id>
< id> spring-milestone< /id>
< name> Spring Maven MILESTONE Repository< /name>
< name> Spring Maven MILESTONE Repository< /name>
< url> http://maven.springframework.org/ milestone< /url>
< url> http://repo.springsource.org/libs- milestone< /url>
< /repository>
< /repository>
< /repositories> </programlisting>
< /repositories> </programlisting>
@ -133,8 +132,9 @@
url="http://shrub.appspot.com/maven.springframework.org/milestone/org/springframework/data/">browseable
url="http://shrub.appspot.com/maven.springframework.org/milestone/org/springframework/data/">browseable
here</ulink> .</para>
here</ulink> .</para>
<para > You may also want to set the logging level to DEBUG to see some
<para > You may also want to set the logging level to <code > DEBUG</code> to
additional information, edit the log4j.properties file to have</para>
see some additional information, edit the log4j.properties file to
have</para>
<programlisting > log4j.category.org.springframework.data.document.mongodb=DEBUG
<programlisting > log4j.category.org.springframework.data.document.mongodb=DEBUG
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %40.40c:%4L - %m%n</programlisting>
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %40.40c:%4L - %m%n</programlisting>
@ -215,9 +215,10 @@ public class MongoApp {
<itemizedlist >
<itemizedlist >
<listitem >
<listitem >
<para > You can instantiate the central helper class of Spring Mongo,
<para > You can instantiate the central helper class of Spring Mongo,
<link linkend= "mongo-template" > MongoTemplate</link> , using the
<link
standard <classname > com.mongodb.Mongo</classname> object and the name
linkend="mongo-template"><classname > MongoTemplate</classname> </link> ,
of the database to use.</para>
using the standard <classname > com.mongodb.Mongo</classname> object and
the name of the database to use.</para>
</listitem>
</listitem>
<listitem >
<listitem >
@ -241,119 +242,6 @@ public class MongoApp {
stored document, they will be used to instantiate the object</para>
stored document, they will be used to instantiate the object</para>
</listitem>
</listitem>
</itemizedlist>
</itemizedlist>
<section id= "mongodb-required-jars" >
<title > Required Jars</title>
The following jars are required to use Spring Data MongoDB
<itemizedlist >
<listitem >
<para > spring-data-mongodb-1.0.0.RELEASE.jar</para>
</listitem>
<listitem >
<para > spring-data-commons-1.2.0.RELEASE.jar</para>
</listitem>
</itemizedlist>
In addition to the above listed Spring Data jars you need to provide the following dependencies:
<itemizedlist >
<listitem >
<para > aopalliance-1.0.0.jar</para>
</listitem>
<listitem >
<para > commons-logging-1.1.1.jar</para>
</listitem>
<listitem >
<para > mongo-java-driver-2.5.3.jar</para>
</listitem>
<listitem >
<para > spring-aop-3.0.7.RELEASE.jar</para>
</listitem>
<listitem >
<para > spring-asm-3.0.7.RELEASE.jar</para>
</listitem>
<listitem >
<para > spring-beans-3.0.7.RELEASE.jar</para>
</listitem>
<listitem >
<para > spring-context-3.0.7.RELEASE.jar</para>
</listitem>
<listitem >
<para > spring-core-3.0.7.RELEASE.jar</para>
</listitem>
<listitem >
<para > spring-expression-3.0.7.RELEASE.jar</para>
</listitem>
</itemizedlist>
</section>
<section id= "mongo.migrate-m2-m3" >
<title > Migrating from M2 to M3</title>
<para > There were several API changes introduced in the M3 release. To
upgrade from M2 to M3 you will need to make. For a full listing of API
changes please refer to this <ulink
url="http://static.springsource.org/spring-data/data-document/docs/jdiff-mongo-m2-m3/mongo-report/">JDiff
Report</ulink> .</para>
<para > The major changes are with respect to MongoTemplate</para>
<itemizedlist >
<listitem >
<para > Constructors have changed on
<classname > MongoTemplate</classname> . <literal > MongoTemplate(Mongo,
String, String)</literal> and <literal > MongoTemplate(Mongo, String,
String, MongoConverter)</literal> were removed.
<literal > MongoTemplate(Mongo, String, UserCredentials),
MongoTemplate(MongoDbFactory), MongoTemplate(MongoDbFactory,
MongoConverter)</literal> were added. These changes will also effect
usage of wiring up <classname > MongoTemplate</classname> in
< bean/> XML defintions.</para>
</listitem>
<listitem >
<para > <classname > MongoTemplate</classname> no longer takes a default
collection name. The collection name is now either specified when
the method is invoked or inferred from the Java class, either the
class name or via mapping metadata.</para>
</listitem>
<listitem >
<para > Reordered parameters in some
<classname > MongoTemplate</classname> methods to make signatures more
consistent across the board.</para>
</listitem>
<listitem >
<para > Removed <classname > MongoTemplate</classname> methods that use
<interfacename > MongoReader</interfacename> and
<interfacename > MongoWriter</interfacename> . As an alternative
register a Spring converter with the MappingMongoConverter. See
<link linkend= "mapping-explicit-converters" > here</link> for
details.</para>
</listitem>
<listitem >
<para > Added <literal > findById</literal> methods to
<classname > MongoTemplate.</classname> </para>
</listitem>
</itemizedlist>
</section>
</section>
</section>
<section id= "mongo.examples-repo" >
<section id= "mongo.examples-repo" >
@ -544,7 +432,6 @@ public class AppConfig {
DB getDb() throws DataAccessException;
DB getDb() throws DataAccessException;
DB getDb(String dbName) throws DataAccessException;
DB getDb(String dbName) throws DataAccessException;
}</programlisting>
}</programlisting>
<para > The following sections show how you can use the contiainer with
<para > The following sections show how you can use the contiainer with
@ -601,7 +488,6 @@ public class MongoConfiguration {
public @Bean MongoDbFactory mongoDbFactory() throws Exception {
public @Bean MongoDbFactory mongoDbFactory() throws Exception {
return new SimpleMongoDbFactory(new Mongo(), "database");
return new SimpleMongoDbFactory(new Mongo(), "database");
}
}
}</programlisting>
}</programlisting>
<para > To define the username and password create an instance of
<para > To define the username and password create an instance of
@ -621,10 +507,7 @@ public class MongoConfiguration {
public @Bean MongoTemplate mongoTemplate() throws Exception {
public @Bean MongoTemplate mongoTemplate() throws Exception {
return new MongoTemplate(mongoDbFactory());
return new MongoTemplate(mongoDbFactory());
}
}
}
}</programlisting>
</programlisting>
<para />
</section>
</section>
<section id= "mongo.mongo-db-factory-xml" >
<section id= "mongo.mongo-db-factory-xml" >
@ -685,8 +568,6 @@ public class MongoConfiguration {
< bean id="anotherMongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
< bean id="anotherMongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
< constructor-arg name="mongoDbFactory" ref="mongoDbFactory"/>
< constructor-arg name="mongoDbFactory" ref="mongoDbFactory"/>
< /bean> </programlisting>
< /bean> </programlisting>
<para />
</section>
</section>
</section>
</section>