Skip to content

Commit 480e89c

Browse files
committed
MW feedback
1 parent 414fcf1 commit 480e89c

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

source/integrations/spring-data-integration.txt

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Tutorial: Spring Data Framework Integration
1717

1818
.. meta::
1919
:description: Build an application using the Spring Data Framework and the MongoDB Java driver.
20-
:keywords: spring, tutorial, bulk insert, code example
20+
:keywords: spring, tutorial, bulk insert, code example, odm, orm
2121

2222
Overview
2323
--------
@@ -29,31 +29,39 @@ MongoDB <https://spring.io/projects/spring-data-mongodb>`__ with the
2929
Spring Data MongoDB
3030
~~~~~~~~~~~~~~~~~~~
3131

32-
Spring Data MongoDB is the official Spring Data ODM for MongoDB. It allows you to
33-
interact with MongoDB by using plain old Java objects (POJOs) and repository
34-
abstraction. It supports MongoDB-specific features like dynamic queries,
32+
Spring Data MongoDB is the official Spring Data object document mapper (ODM) for
33+
MongoDB. It allows you to interact with MongoDB by using plain old Java objects
34+
(POJOs) and repository abstraction. It supports MongoDB-specific features like dynamic queries,
3535
indexing, and nested document mapping while reducing boilerplate code such as
3636
manual ``find()`` and ``update()`` calls.
3737

38+
Spring Boot
39+
~~~~~~~~~~~
40+
Spring Boot is a framework built on top of the Spring Framework. It adds
41+
auto-configuration, defaults, and production-ready features to simplify building
42+
Spring-based Java applications, including integration with Spring Data
43+
MongoDB. For more information, see the `Spring Boot documentation
44+
<https://spring.io/projects/spring-boot>`__.
45+
3846
Dependency Injection
3947
~~~~~~~~~~~~~~~~~~~~
4048

4149
Dependency injection (DI) is a core principle of the Spring Framework. It
42-
allows objects, called beans, to be created and managed by the Spring container,
50+
allows objects, called *beans*, to be created and managed by the Spring container,
4351
then injected into other beans that use them. This is distinct from typical
44-
object-oriented development where classes are responsible for initializing and
45-
constructing the objects they use.
52+
object-oriented development, where classes are responsible for initializing and
53+
constructing the objects that they use.
4654

4755
For more information about dependency injection, see the `Dependency
4856
Injection <https://docs.spring.io/spring-framework/reference/core/beans/dependencies/factory-collaborators.html>`__
4957
page of the Spring Framework documentation.
5058

51-
The Spring Data BulkOperations Interface
52-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59+
Spring Data BulkOperations Interface
60+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5361

54-
BulkOperations is a Spring Data MongoDB interface that contains a list of write
62+
``BulkOperations`` is a Spring Data MongoDB interface that contains a list of write
5563
operations that can be applied to your database. It can handle any combination of
56-
the following operations which map to similar {+driver-long+} operations:
64+
the following operations, which map to similar {+driver-long+} operations:
5765

5866
- ``insert``
5967
- ``updateOne``
@@ -63,7 +71,7 @@ the following operations which map to similar {+driver-long+} operations:
6371
- ``deleteMany``
6472
- ``upsert``
6573

66-
A BulkOperation can be ordered or unordered. Ordered bulk operations run operations
74+
A ``BulkOperation`` can be ordered or unordered. Ordered bulk operations run operations
6775
sequentially, and if an error is detected, return with an error code.
6876
Unordered operations are run in parallel, which means they are typically faster.
6977
However, you must manually check if there were errors during the operations.
@@ -74,7 +82,7 @@ For more information about bulk operations, see the following resources:
7482
<https://docs.spring.io/spring-data/mongodb/docs/current/api/org/springframework/data/mongodb/core/BulkOperations.html>`__
7583
in the Spring Framework API documentation
7684
- :ref:`Bulk Write Operations <java-fundamentals-bulkwrite>` in this guide
77-
- :manual:`Bulk Write Operations </core/bulk-write-operations/>` in the MongoDB server manual
85+
- :manual:`Bulk Write Operations </core/bulk-write-operations/>` in the MongoDB Server manual
7886

7987
Tutorial
8088
--------
@@ -90,7 +98,7 @@ You can find the completed sample app for this tutorial in the
9098
Prerequisites
9199
~~~~~~~~~~~~~
92100

93-
Ensure you have the following components installed and set up before you start
101+
Ensure that you have the following components installed and set up before you start
94102
this tutorial:
95103

96104
- `Java 8 or later <https://www.oracle.com/java/technologies/downloads/>`__
@@ -102,7 +110,7 @@ Add Dependencies
102110
~~~~~~~~~~~~~~~~
103111

104112
Ensure that you use a Spring Data MongoDB version that is compatible with the
105-
{+driver-long+} and Java versions you are using. For compatibility specifications, see
113+
{+driver-long+} and Java versions that you are using. For compatibility specifications, see
106114
the `Requirements
107115
<https://docs.spring.io/spring-data/mongodb/reference/preface.html>`__ page
108116
of the Spring Data MongoDB documentation, and the :ref:`Compatibility
@@ -112,7 +120,7 @@ of the Spring Data MongoDB documentation, and the :ref:`Compatibility
112120

113121
If you used the `Spring Initializr <https://start.spring.io/>`__ or a clone of the :github:`Spring Boot sample project <spring-guides/gs-spring-boot>` to create your project, versioning compatibility has already been accounted for, and the ``spring-boot-starter-data-mongodb`` component will already be included in your ``pom.xml`` file.
114122

115-
Add the following dependencies to your ``pom.xml``:
123+
Add the following dependencies to your ``pom.xml`` file:
116124

117125
.. code-block:: xml
118126

@@ -133,17 +141,17 @@ objects to use in the bulk write operation.
133141
Configure your MongoClient
134142
~~~~~~~~~~~~~~~~~~~~~~~~~~
135143

136-
The ``MongoConfig`` class contains the configuration for the ``MongoClient``
137-
that will allow the Spring Data framework to interact with the MongoDB server,
144+
The ``MongoConfig`` class contains the configuration for the ``MongoClient`` object
145+
that will allow the Spring Data framework to interact with the MongoDB Server,
138146
and sets other configuration options. For more information about configuration
139147
options, see the :ref:`Specify Connection Options <specify-mongoclient-settings>`
140148
page of this guide.
141149

142150
This application uses ``@Configuration`` annotations for classes, ``@Bean``
143151
annotations for methods, and ``@Value`` annotations for parameter conversion.
144-
These annotations allow the Spring IoC container to manage objects. For a
145-
detailed explanation of these annotations, see the following sections of the
146-
Spring Data framework guide:
152+
These annotations allow the Spring IoC (Inversion of Control) container to
153+
manage objects. For a detailed explanation of these annotations, see the
154+
following sections of the Spring Data framework guide:
147155

148156
- ``@Configuration`` and ``@Bean`` annotations: `Java-based Container
149157
Configuration
@@ -158,7 +166,6 @@ template classes to set up your MongoDB connection:
158166
:start-after: // start-mongoconfig
159167
:end-before: // end-mongoconfig
160168
:language: java
161-
:dedent:
162169

163170
.. note:: API vs Interface
164171

@@ -173,7 +180,6 @@ database name (``mongodb.database``), and bulk operation count (``documentCount`
173180
:start-after: # start-mongoconfig-properties
174181
:end-before: # end-mongoconfig-properties
175182
:language: console
176-
:dedent:
177183

178184
This tutorial uses a database named ``bulk``, and creates 25000 documents to save. Replace the ``<connection
179185
string>`` placeholder with a connection string for your Atlas deployment. For
@@ -191,7 +197,7 @@ documents, see the `Mapping Annotation Overview
191197
section of the Spring Data MongoDB documentation.
192198

193199
The ``@Id`` annotation in the following code indicates that the ``id`` field
194-
maps to the ``_id`` field which is used as a unique identifier in MongoDB documents. You can choose any field of
200+
maps to the ``_id`` field, which is used as a unique identifier in MongoDB documents. You can choose any field of
195201
any type, except arrays, to be the unique identifier. For more information, see
196202
the `How the _id field is handled in the mapping layer
197203
<https://docs.spring.io/spring-data/mongodb/reference/mongodb/mapping/mapping.html#mapping.conventions.id-field>`__
@@ -204,16 +210,15 @@ your ``products`` collection with the following code:
204210
:start-after: // start-products-class
205211
:end-before: // end-products-class
206212
:language: java
207-
:dedent:
208213

209214
The ``Product`` class includes a static method that generates an array of
210215
``Product`` objects. You may also define getters and setters for each field.
211216

212217
Define a Repository to Store Your Products
213218
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214219

215-
The ``ProductRepository`` will manage a collection of ``Product`` objects.
216-
Your ``ProductRepository`` references the client creation methods defined in the ``MongoConfig`` class, which you
220+
The ``ProductRepository`` object will manage a collection of ``Product`` objects.
221+
Your ``ProductRepository`` object references the client-creation methods defined in the ``MongoConfig`` class, which you
217222
annotated with ``@Bean``. By using the ``@Autowired`` annotation with the
218223
``mongoTemplate`` variable together with a constructor that includes
219224
``mongoTemplate`` as an argument, the Spring container uses constructor
@@ -229,7 +234,6 @@ class to manage a collection of ``Product`` objects with the following code:
229234
:start-after: // start-productrepo
230235
:end-before: // end-productrepo
231236
:language: java
232-
:dedent:
233237

234238
The ``bulkInsertProducts()`` method uses unordered bulk inserts, which can
235239
improve performance by not guaranteeing the order of operations.
@@ -247,7 +251,6 @@ Add the following code to your main class to run your application:
247251
:start-after: // start-application
248252
:end-before: // end-application
249253
:language: java
250-
:dedent:
251254

252255
Conclusion
253256
----------

0 commit comments

Comments
 (0)