Skip to content

Commit

Permalink
Clarify StoreResolver docs
Browse files Browse the repository at this point in the history
- add multiple stores to the example with explanation
#201
  • Loading branch information
paulcwarren committed Jul 7, 2020
1 parent ae388c7 commit c6d28a0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions spring-content-rest/src/main/asciidoc/rest-storeresolver.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ For these situations you need to provide a `StoreResolver` that, based on runtim
====
[source, java]
----
public interface S3ExampleStore extends S3ContentStore<Example, UUID>{}
public interface FSExampleStore extends FilesystemContentStore<Example, UUID>{} <1>
@Configuration
@EnableS3Stores
@EnableFilesystemStores
public static class ApplicationConfig {
@Bean
public ContentRestConfigurer contentRestConfigurer() {
return new ContentRestConfigurer() {
@Override
public void configure(RestConfiguration config) {
config.addStoreResolver("examples", new StoreResolver() { <1>
config.addStoreResolver("examples", new StoreResolver() { <2>
@Override
public StoreInfo resolve(StoreInfo... stores) {
/* your resolver implementation */
Expand All @@ -28,6 +32,8 @@ public static class ApplicationConfig {
}
}
----
<1> This store resolver resolves conflicts for stores exported through the path "examples"
<1> Both stores are typed to the domain type `Example` and will therefore be exported to the URI `/examples`
<2> Store resolver resolves requests to `/examples/...` to either S3ExamplesStore or FSExampleStore, depending
on request context.
====

0 comments on commit c6d28a0

Please sign in to comment.