diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 609a483d586..d45f026c2f3 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -230,6 +230,11 @@ spring-boot-starter-batch 1.3.0.BUILD-SNAPSHOT + + org.springframework.boot + spring-boot-starter-cache + 1.3.0.BUILD-SNAPSHOT + org.springframework.boot spring-boot-starter-cloud-connectors diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 554f8933d9a..f7940f2caa9 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -2331,6 +2331,9 @@ TIP: It is also possible to {spring-reference}/#cache-annotations-put[update] or === Supported cache providers +NOTE: To easily get started, just add `spring-boot-starter-cache` to the dependencies of +your application. + The cache abstraction does not provide an actual store and relies on a abstraction materialized by the `org.springframework.cache.Cache` and `org.springframework.cache.CacheManager` interfaces. Spring Boot auto-configures a diff --git a/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc b/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc index d7c7930f2c9..3e06876cab9 100644 --- a/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc +++ b/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc @@ -267,6 +267,9 @@ The following application starters are provided by Spring Boot under the |`spring-boot-starter-batch` |Support for "`Spring Batch`" including HSQLDB database. +|`spring-boot-starter-cache` +|Support for Spring's Cache abstraction. + |`spring-boot-starter-cloud-connectors` |Support for "`Spring Cloud Connectors`" which simplifies connecting to services in cloud platforms like Cloud Foundry and Heroku. diff --git a/spring-boot-samples/spring-boot-sample-cache/README.adoc b/spring-boot-samples/spring-boot-sample-cache/README.adoc index 91b1b0551ca..6de6f0e05af 100644 --- a/spring-boot-samples/spring-boot-sample-cache/README.adoc +++ b/spring-boot-samples/spring-boot-sample-cache/README.adoc @@ -16,6 +16,15 @@ the application starts a client invokes the service with a random code every 500 can look at the `/metrics` endpoint to review the cache statistics if your chosen caching provider is supported. +== Using the JSR-107 annotations + +The sample uses Spring's cache annotation. If you want to use the JSR-107 annotations +instead, simply add the `javax.cache:cache-api` dependency to the project. No further +configuration is necessary. + +NOTE: You can use the JSR-107 annotations with _any_ cache provider; a JSR-107 compliant +cache provider is not necessary. + == Using a different cache provider Initially, the project does not define any caching library so the abstraction works @@ -45,11 +54,8 @@ can set the `spring.cache.infinispan.config` property to use the provided === JCache (JSR-107) -You do not need to use a JSR-107 compliant `CacheManager` to use the standard -annotations. As a matter of a fact, this sample uses by default the standard annotations -with a simple map-based `CacheManager` by default. If you want to configure your cache -infrastructure via the standard, you need a compliant implementation. You could try -the following: +If you want to configure your cache infrastructure via the standard, you need a compliant +implementation. You could try the following: * `Hazelcast`: add `com.hazelcast:hazelcast` * `Infinispan`: add `org.infinispan:infinispan-jcache` diff --git a/spring-boot-samples/spring-boot-sample-cache/pom.xml b/spring-boot-samples/spring-boot-sample-cache/pom.xml index 2d17131dfc2..d035d055038 100644 --- a/spring-boot-samples/spring-boot-sample-cache/pom.xml +++ b/spring-boot-samples/spring-boot-sample-cache/pom.xml @@ -20,6 +20,12 @@ ${basedir}/../.. + + org.springframework.boot + spring-boot-starter-cache + + + org.springframework.boot spring-boot-starter-web @@ -28,15 +34,6 @@ org.springframework.boot spring-boot-starter-actuator - - org.springframework - spring-context-support - - - javax.cache - cache-api - - Loading country with code '" + code + "'"); return new Country(code); diff --git a/spring-boot-starters/pom.xml b/spring-boot-starters/pom.xml index 120ad5666b2..9b562980773 100644 --- a/spring-boot-starters/pom.xml +++ b/spring-boot-starters/pom.xml @@ -24,6 +24,7 @@ spring-boot-starter-amqp spring-boot-starter-aop spring-boot-starter-batch + spring-boot-starter-cache spring-boot-starter-cloud-connectors spring-boot-starter-data-elasticsearch spring-boot-starter-data-gemfire diff --git a/spring-boot-starters/spring-boot-starter-cache/pom.xml b/spring-boot-starters/spring-boot-starter-cache/pom.xml new file mode 100644 index 00000000000..133f44c5308 --- /dev/null +++ b/spring-boot-starters/spring-boot-starter-cache/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starters + 1.3.0.BUILD-SNAPSHOT + + spring-boot-starter-cache + Spring Boot Cache Starter + Spring Boot Cache Starter + http://projects.spring.io/spring-boot/ + + Pivotal Software, Inc. + http://www.spring.io + + + ${basedir}/../.. + + + + org.springframework.boot + spring-boot-starter + + + org.springframework + spring-context + + + org.springframework + spring-context-support + + + diff --git a/spring-boot-starters/spring-boot-starter-cache/src/main/resources/META-INF/spring.provides b/spring-boot-starters/spring-boot-starter-cache/src/main/resources/META-INF/spring.provides new file mode 100644 index 00000000000..e50e626a446 --- /dev/null +++ b/spring-boot-starters/spring-boot-starter-cache/src/main/resources/META-INF/spring.provides @@ -0,0 +1 @@ +provides: spring-context-support \ No newline at end of file