From 31eac0142a8b64c166928998a6c4af2d9e5758bf Mon Sep 17 00:00:00 2001 From: John Blum Date: Sun, 5 Feb 2017 23:55:41 -0800 Subject: [PATCH] Improve spring-boot-sample-cache UX by using Maven profiles Fixes gh-8202 --- .../spring-boot-sample-cache/README.adoc | 8 + .../spring-boot-sample-cache/pom.xml | 181 +++++++++++------- 2 files changed, 117 insertions(+), 72 deletions(-) diff --git a/spring-boot-samples/spring-boot-sample-cache/README.adoc b/spring-boot-samples/spring-boot-sample-cache/README.adoc index 7bc450fb397e..0e0d7c4c7869 100644 --- a/spring-boot-samples/spring-boot-sample-cache/README.adoc +++ b/spring-boot-samples/spring-boot-sample-cache/README.adoc @@ -64,6 +64,7 @@ used to configure the underlying `CacheManager`. Note that EhCache 3 uses a diff format and doesn't default to `ehcache.xml` anymore. Check http://www.ehcache.org/documentation/3.0/xml.html[the documentation] for more details. +Run sample cache application using EhCache with `$mvn -P ehcache spring-boot:run` === Hazelcast @@ -72,6 +73,7 @@ the project to enable support for Hazelcast. Since there is a default `hazelcas configuration file at the root of the classpath, it is used to automatically configure the underlying `HazelcastInstance`. +Run sample cache application using Hazelcast with `$mvn -P hazelcast spring-boot:run` === Infinispan @@ -81,18 +83,21 @@ so if you don't specify anything it will bootstrap on a hardcoded default. You c the `spring.cache.infinispan.config` property to use the provided `infinispan.xml` configuration instead. +Run sample cache application using Infinispan with `$mvn -P infinispan spring-boot:run` === Couchbase Add the `java-client` and `couchbase-spring-cache` dependencies and make sure that you have setup at least a `spring.couchbase.bootstrap-hosts` property. +Start a Couchbase server, then run the sample cache application using Couchbase with `$mvn -P couchbase spring-boot:run` === Redis Add the `spring-boot-starter-data-redis` and make sure it is configured properly (by default, a redis instance with the default settings is expected on your local box). +Start a Redis server, then run the sample cache application using Redis with `$mvn -P redis spring-boot:run` === Caffeine @@ -100,6 +105,7 @@ Simply add the `com.github.ben-manes.caffeine:caffeine` dependency to enable sup for Caffeine. You can customize how caches are created in different ways, see `application.properties` for an example and the documentation for more details. +Run sample cache application using Caffeine with `$mvn -P caffeine spring-boot:run` === Guava @@ -107,3 +113,5 @@ Spring Boot does not provide any dependency management for _Guava_ so you'll hav the `com.google.guava:guava` dependency with a version. You can customize how caches are created in different ways, see `application.properties` for an example and the documentation for more details. + +Run sample cache application using Guava with `$mvn -P guava spring-boot:run` diff --git a/spring-boot-samples/spring-boot-sample-cache/pom.xml b/spring-boot-samples/spring-boot-sample-cache/pom.xml index 8a5eb6c092b3..91035e716bf7 100644 --- a/spring-boot-samples/spring-boot-sample-cache/pom.xml +++ b/spring-boot-samples/spring-boot-sample-cache/pom.xml @@ -33,78 +33,6 @@ org.springframework.boot spring-boot-starter-actuator - - - - - - - - - - - - - - org.springframework.boot @@ -120,4 +48,113 @@ + + + + + jcache + + + javax.cache + cache-api + + + + + + caffeine + + + com.github.ben-manes.caffeine + caffeine + + + + + + + couchbase + + + com.couchbase.client + java-client + + + com.couchbase.client + couchbase-spring-cache + + + + + + ehcache + + + net.sf.ehcache + ehcache + + + + + + + org-ehcache + + + org.ehcache + ehcache + + + + + + guava + + + com.google.guava + guava + 18.0 + + + + + + hazelcast + + + com.hazelcast + hazelcast + + + com.hazelcast + hazelcast-spring + + + + + + infinispan + + + org.infinispan + infinispan-spring4-embedded + + + org.infinispan + infinispan-jcache + + + + + + + redis + + + org.springframework.boot + spring-boot-starter-data-redis + + + +