Skip to content

Commit 162379d

Browse files
committed
Polishing.
Tweak wording. Add callouts. See #358 Original pull request: #364.
1 parent 01b2e61 commit 162379d

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/main/asciidoc/index.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
= Spring Data Key-Value Reference Guide
2-
Oliver Gierke; Thomas Darimont; Christoph Strobl; Jay Bryant
2+
Oliver Gierke; Thomas Darimont; Christoph Strobl; Jay Bryant; Mark Paluch
33
:revnumber: {version}
44
:revdate: {localdate}
55
ifdef::backend-epub3[:front-cover-image: image:epub-cover.png[Front Cover,1050,1600]]
66
:spring-data-commons-docs: https://raw.githubusercontent.com/spring-projects/spring-data-commons/master/src/main/asciidoc
7+
:spring-data-keyvalue-docs: https://docs.spring.io/spring-data/keyvalue/docs/{version}/api/
78
:spring-framework-docs: https://docs.spring.io/spring-framework/docs/{springVersion}/spring-framework-reference/
89

910
(C) 2008-2021 The original authors.

src/main/asciidoc/key-value-repositories.adoc

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,29 @@ In its very basic shape, the `KeyValueTemplate` uses a `MapAdapter` that wraps a
4646

4747
NOTE: The used `KeyValueAdapter` does the heavy lifting when it comes to storing and retrieving data. The data structure influences performance and multi-threading behavior.
4848

49-
You can use a different type or preinitialize the adapter with some values, and you can do so by using various constructors on `MapKeyValueAdapter`, as the following example shows:
49+
You can use a different type or pre-initialize the adapter with some values, and you can do so by using various constructors on `MapKeyValueAdapter`, as the following example shows:
5050

51+
====
5152
[source, java]
5253
----
53-
@Bean
54-
public KeyValueOperations mapKeyValueTemplate() {
55-
return new KeyValueTemplate(keyValueAdapter());
56-
}
54+
@EnableMapRepositories
55+
@Configuration
56+
class MyConfiguration {
5757
58-
@Bean
59-
public KeyValueAdapter keyValueAdapter() {
60-
return new MapKeyValueAdapter(ConcurrentHashMap.class);
58+
@Bean
59+
public KeyValueOperations mapKeyValueTemplate() { <1>
60+
return new KeyValueTemplate(keyValueAdapter());
61+
}
62+
63+
@Bean
64+
public KeyValueAdapter keyValueAdapter() {
65+
return new MapKeyValueAdapter(ConcurrentHashMap.class); <2>
66+
}
6167
}
6268
----
63-
64-
Alternatively, you might use `@EnableMapRepositories(keyValueTemplateRef=…)`.
69+
<1> Defines a custom `KeyValueOperations` bean using the default bean name. See documentation and properties of {spring-data-keyvalue-docs}org/springframework/data/map/repository/config/EnableMapRepositories.html[`@EnableMapRepositories`] for further customization.
70+
<2> Defines a custom `KeyValueAdapter` bean using a `ConcurrentHashMap` as storage that is used by `KeyValueTemplate`.
71+
====
6572

6673
[[key-value.keyspaces]]
6774
== Keyspaces

0 commit comments

Comments
 (0)