Polishing.

Tweak wording. Add callouts.

See #358
Original pull request: #364.
This commit is contained in:
Mark Paluch
2021-03-18 14:55:14 +01:00
parent 9713a59e85
commit 023b0906d7
2 changed files with 19 additions and 11 deletions

View File

@@ -1,9 +1,10 @@
= Spring Data Key-Value Reference Guide
Oliver Gierke; Thomas Darimont; Christoph Strobl; Jay Bryant
Oliver Gierke; Thomas Darimont; Christoph Strobl; Jay Bryant; Mark Paluch
:revnumber: {version}
:revdate: {localdate}
ifdef::backend-epub3[:front-cover-image: image:epub-cover.png[Front Cover,1050,1600]]
:spring-data-commons-docs: https://raw.githubusercontent.com/spring-projects/spring-data-commons/master/src/main/asciidoc
:spring-data-keyvalue-docs: https://docs.spring.io/spring-data/keyvalue/docs/{version}/api/
:spring-framework-docs: https://docs.spring.io/spring-framework/docs/{springVersion}/spring-framework-reference/
(C) 2008-2021 The original authors.

View File

@@ -46,22 +46,29 @@ In its very basic shape, the `KeyValueTemplate` uses a `MapAdapter` that wraps a
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.
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:
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:
====
[source, java]
----
@Bean
public KeyValueOperations mapKeyValueTemplate() {
return new KeyValueTemplate(keyValueAdapter());
}
@EnableMapRepositories
@Configuration
class MyConfiguration {
@Bean
public KeyValueAdapter keyValueAdapter() {
return new MapKeyValueAdapter(ConcurrentHashMap.class);
@Bean
public KeyValueOperations mapKeyValueTemplate() { <1>
return new KeyValueTemplate(keyValueAdapter());
}
@Bean
public KeyValueAdapter keyValueAdapter() {
return new MapKeyValueAdapter(ConcurrentHashMap.class); <2>
}
}
----
Alternatively, you might use `@EnableMapRepositories(keyValueTemplateRef=…)`.
<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.
<2> Defines a custom `KeyValueAdapter` bean using a `ConcurrentHashMap` as storage that is used by `KeyValueTemplate`.
====
[[key-value.keyspaces]]
== Keyspaces