|
| 1 | += REST Interface |
| 2 | + |
| 3 | +To utilize the https://docs.eclipsestore.io/manual/storage/rest-interface/index.html[REST interface provided by EclipseStore], only a small adjustment is needed. |
| 4 | + |
| 5 | +First add the dependency described in the https://docs.eclipsestore.io/manual/storage/rest-interface/setup.html#_spring_boot_rest_service[EclipseStore documentation]: |
| 6 | +
|
| 7 | +[source,xml,subs=attributes+,title="Maven [pom.xml]"] |
| 8 | +---- |
| 9 | +<dependencies> |
| 10 | + <dependency> |
| 11 | + <groupId>org.eclipse.store</groupId> |
| 12 | + <artifactId>storage-restservice-springboot</artifactId> |
| 13 | + </dependency> |
| 14 | + <dependency> |
| 15 | + <groupId>org.springframework.boot</groupId> |
| 16 | + <artifactId>spring-boot-starter-web</artifactId> |
| 17 | + </dependency> |
| 18 | +</dependencies> |
| 19 | +---- |
| 20 | +
|
| 21 | +Next a few adjustments are needed in your configuration: |
| 22 | +
|
| 23 | +[source,java,title="https://github.com/xdev-software/spring-data-eclipse-store/blob/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/ComplexConfiguration.java[Example from complex demo]"] |
| 24 | +---- |
| 25 | +package software.xdev.spring.data.eclipse.store.demo.complex; |
| 26 | +
|
| 27 | +//... |
| 28 | +import org.eclipse.store.storage.restadapter.types.StorageRestAdapter; |
| 29 | +import org.springframework.context.annotation.Bean; |
| 30 | +import org.springframework.context.annotation.ComponentScan; |
| 31 | +import org.springframework.context.annotation.Configuration; |
| 32 | +
|
| 33 | +import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration; |
| 34 | +import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories; |
| 35 | +
|
| 36 | +
|
| 37 | +@ComponentScan({"org.eclipse.store.storage.restservice.spring.boot.types.rest"}) |
| 38 | +@Configuration |
| 39 | +@EnableEclipseStoreRepositories |
| 40 | +public class ComplexConfiguration extends EclipseStoreClientConfiguration |
| 41 | +{ |
| 42 | + //... |
| 43 | + @Bean |
| 44 | + @DependsOn({"embeddedStorageFoundationFactory"}) |
| 45 | + public Map<String, StorageRestAdapter> storageRestAdapters(final Map<String, EmbeddedStorageManager> storages) |
| 46 | + { |
| 47 | + return Map.of( |
| 48 | + "defaultStorageManager", StorageRestAdapter.New(this.storageInstance.getInstanceOfStorageManager()) |
| 49 | + ); |
| 50 | + } |
| 51 | + //... |
| 52 | +---- |
| 53 | +
|
| 54 | +After that the API is usable just like https://docs.eclipsestore.io/manual/storage/rest-interface/rest-api.html[plain EclipseStore]. |
| 55 | +The ``instance-name`` in this case would be ``default`` which means, the active URL in the ComplexDemo is ``http://localhost:8080/store-data/default/root``. |
0 commit comments