You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not all modules have a XML namespace.
Therefore it is now possible to exclude parts that reference the XML namespace from the documentation
By default the parts referring to the XML namespace are included just as before.
But they will get skipped if the `index.adoc` of the module defines the attribute `include-xml-namespaces` as `false` by including
```
:include-xml-namespaces: false
```
Closes#2662
See spring-projects/spring-data-relational#1290
Original pull request #2664
Copy file name to clipboardExpand all lines: src/main/asciidoc/repositories.adoc
+27-5
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,10 @@ _Spring Data repository documentation and your module_
13
13
This chapter explains the core concepts and interfaces of Spring Data repositories.
14
14
The information in this chapter is pulled from the Spring Data Commons module.
15
15
It uses the configuration and code samples for the Java Persistence API (JPA) module.
16
-
You should adapt the XML namespace declaration and the types to be extended to the equivalents of the particular module that you use. "`<<repositories.namespace-reference>>`" covers XML configuration, which is supported across all Spring Data modules that support the repository API. "`<<repository-query-keywords>>`" covers the query method keywords supported by the repository abstraction in general.
16
+
ifeval::[{include-xml-namespaces} != false]
17
+
You should adapt the XML namespace declaration and the types to be extended to the equivalents of the particular module that you use. "`<<repositories.namespace-reference>>`" covers XML configuration, which is supported across all Spring Data modules that support the repository API.
18
+
endif::[]
19
+
"`<<repository-query-keywords>>`" covers the query method keywords supported by the repository abstraction in general.
17
20
For detailed information on the specific features of your module, see the chapter on that module of this document.
18
21
====
19
22
@@ -154,6 +157,7 @@ class Config { … }
154
157
----
155
158
====
156
159
160
+
ifeval::[{include-xml-namespaces} != false]
157
161
.. To use XML configuration, define a bean similar to the following:
158
162
+
159
163
====
@@ -177,8 +181,9 @@ class Config { … }
177
181
The JPA namespace is used in this example.
178
182
If you use the repository abstraction for any other store, you need to change this to the appropriate namespace declaration of your store module.
179
183
In other words, you should exchange `jpa` in favor of, for example, `mongodb`.
184
+
endif::[]
180
185
+
181
-
Also, note that the JavaConfig variant does not configure a package explicitly, because the package of the annotated class is used by default.
186
+
Note that the JavaConfig variant does not configure a package explicitly, because the package of the annotated class is used by default.
182
187
To customize the package to scan, use one of the `basePackage…` attributes of the data-store-specific repository's `@Enable${store}Repositories`-annotation.
183
188
. Inject the repository instance and use it, as shown in the following example:
184
189
+
@@ -397,7 +402,9 @@ The next section describes the available options.
397
402
=== Query Lookup Strategies
398
403
399
404
The following strategies are available for the repository infrastructure to resolve the query.
405
+
ifeval::[{include-xml-namespaces} != false]
400
406
With XML configuration, you can configure the strategy at the namespace through the `query-lookup-strategy` attribute.
407
+
endif::[]
401
408
For Java configuration, you can use the `queryLookupStrategy` attribute of the `Enable${store}Repositories` annotation.
402
409
Some strategies may not be supported for particular datastores.
This section covers how to create instances and bean definitions for the defined repository interfaces. One way to do so is by using the Spring namespace that is shipped with each Spring Data module that supports the repository mechanism, although we generally recommend using Java configuration.
888
+
This section covers how to create instances and bean definitions for the defined repository interfaces.
889
+
ifeval::[{include-xml-namespaces} != false]
890
+
One way to do so is by using the Spring namespace that is shipped with each Spring Data module that supports the repository mechanism, although we generally recommend using Java configuration.
891
+
endif::[]
882
892
883
893
[[repositories.create-instances.spring]]
894
+
ifeval::[{include-xml-namespaces} != false]
884
895
=== XML Configuration
885
896
886
897
Each Spring Data module includes a `repositories` element that lets you define a base package that Spring scans for you, as shown in the following example:
@@ -932,6 +943,7 @@ For example, to exclude certain interfaces from instantiation as repository bean
932
943
====
933
944
934
945
The preceding example excludes all interfaces ending in `SomeRepository` from being instantiated.
If you use namespace configuration, the repository infrastructure tries to autodetect custom implementation fragments by scanning for classes below the package in which it found a repository.
1128
-
These classes need to follow the naming convention of appending the namespace element's `repository-impl-postfix` attribute to the fragment interface name.
1139
+
The repository infrastructure tries to autodetect custom implementation fragments by scanning for classes below the package in which it found a repository.
1140
+
These classes need to follow the naming convention of appending
1141
+
ifeval::[{include-xml-namespaces} != false]
1142
+
the namespace element's `repository-impl-postfix` attribute to the fragment interface name.
1129
1143
This postfix defaults to `Impl`.
1144
+
endif::[]
1145
+
ifeval::[{include-xml-namespaces} == false]
1146
+
`Impl` to the fragment interface name.
1147
+
endif::[]
1130
1148
The following example shows a repository that uses the default postfix and a repository that sets a custom value for the postfix:
1131
1149
1132
1150
.Configuration example
@@ -1244,6 +1262,7 @@ class ApplicationConfiguration { … }
1244
1262
----
1245
1263
====
1246
1264
1265
+
ifeval::[{include-xml-namespaces} != false]
1247
1266
A corresponding attribute is available in the XML namespace, as shown in the following example:
1248
1267
1249
1268
.Configuring a custom repository base class using XML
@@ -1254,6 +1273,7 @@ A corresponding attribute is available in the XML namespace, as shown in the fol
TIP: You can register a `QuerydslBinderCustomizerDefaults` bean holding default Querydsl bindings before applying specific bindings from the repository or `@QuerydslPredicate`.
1699
1719
1720
+
ifeval::[{include-xml-namespaces} != false]
1700
1721
[[core.repository-populators]]
1701
1722
=== Repository Populators
1702
1723
@@ -1774,3 +1795,4 @@ The following example shows how to unmarshall a repository populator with JAXB:
0 commit comments