Create spring-boot-cache module

This commit is contained in:
Stéphane Nicoll 2025-03-30 09:43:37 +02:00 committed by Andy Wilkinson
parent 6b769ebd98
commit 6932ab8fae
62 changed files with 207 additions and 120 deletions

View File

@ -50,6 +50,7 @@ include "spring-boot-project:spring-boot-artemis"
include "spring-boot-project:spring-boot-autoconfigure" include "spring-boot-project:spring-boot-autoconfigure"
include "spring-boot-project:spring-boot-autoconfigure-all" include "spring-boot-project:spring-boot-autoconfigure-all"
include "spring-boot-project:spring-boot-batch" include "spring-boot-project:spring-boot-batch"
include "spring-boot-project:spring-boot-cache"
include "spring-boot-project:spring-boot-cassandra" include "spring-boot-project:spring-boot-cassandra"
include "spring-boot-project:spring-boot-couchbase" include "spring-boot-project:spring-boot-couchbase"
include "spring-boot-project:spring-boot-data-cassandra" include "spring-boot-project:spring-boot-data-cassandra"

View File

@ -20,6 +20,7 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-activemq")) optional(project(":spring-boot-project:spring-boot-activemq"))
optional(project(":spring-boot-project:spring-boot-amqp")) optional(project(":spring-boot-project:spring-boot-amqp"))
optional(project(":spring-boot-project:spring-boot-artemis")) optional(project(":spring-boot-project:spring-boot-artemis"))
optional(project(":spring-boot-project:spring-boot-cache"))
optional(project(":spring-boot-project:spring-boot-couchbase")) optional(project(":spring-boot-project:spring-boot-couchbase"))
optional(project(":spring-boot-project:spring-boot-data-cassandra")) optional(project(":spring-boot-project:spring-boot-data-cassandra"))
optional(project(":spring-boot-project:spring-boot-data-elasticsearch")) optional(project(":spring-boot-project:spring-boot-data-elasticsearch"))

View File

@ -24,7 +24,6 @@ import org.springframework.boot.actuate.cache.CachesEndpoint;
import org.springframework.boot.actuate.cache.CachesEndpointWebExtension; import org.springframework.boot.actuate.cache.CachesEndpointWebExtension;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@ -38,7 +37,7 @@ import org.springframework.context.annotation.Bean;
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 2.1.0 * @since 2.1.0
*/ */
@AutoConfiguration(after = CacheAutoConfiguration.class) @AutoConfiguration(afterName = "org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration")
@ConditionalOnClass(CacheManager.class) @ConditionalOnClass(CacheManager.class)
@ConditionalOnAvailableEndpoint(CachesEndpoint.class) @ConditionalOnAvailableEndpoint(CachesEndpoint.class)
public class CachesEndpointAutoConfiguration { public class CachesEndpointAutoConfiguration {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.metrics.cache;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.cache.Cache; import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
@ -32,7 +31,8 @@ import org.springframework.context.annotation.Import;
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 2.0.0 * @since 2.0.0
*/ */
@AutoConfiguration(after = { MetricsAutoConfiguration.class, CacheAutoConfiguration.class }) @AutoConfiguration(after = MetricsAutoConfiguration.class,
afterName = "org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration")
@ConditionalOnBean(CacheManager.class) @ConditionalOnBean(CacheManager.class)
@Import({ CacheMeterBinderProvidersConfiguration.class, CacheMetricsRegistrarConfiguration.class }) @Import({ CacheMeterBinderProvidersConfiguration.class, CacheMetricsRegistrarConfiguration.class })
public class CacheMetricsAutoConfiguration { public class CacheMetricsAutoConfiguration {

View File

@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun; import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration; import org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurer; import org.springframework.cache.annotation.CachingConfigurer;

View File

@ -12,6 +12,7 @@ dependencies {
api(project(":spring-boot-project:spring-boot-all")) api(project(":spring-boot-project:spring-boot-all"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-autoconfigure-all")) dockerTestImplementation(project(":spring-boot-project:spring-boot-autoconfigure-all"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-cache"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-neo4j")) dockerTestImplementation(project(":spring-boot-project:spring-boot-neo4j"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-test")) dockerTestImplementation(project(":spring-boot-project:spring-boot-test"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker")) dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker"))

View File

@ -28,7 +28,7 @@ import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers; import org.testcontainers.junit.jupiter.Testcontainers;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration; import org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration;
import org.springframework.boot.data.redis.autoconfigure.RedisAutoConfiguration; import org.springframework.boot.data.redis.autoconfigure.RedisAutoConfiguration;
import org.springframework.boot.test.context.assertj.AssertableApplicationContext; import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;

View File

@ -33,14 +33,12 @@ dependencies {
dockerTestImplementation("org.junit.jupiter:junit-jupiter") dockerTestImplementation("org.junit.jupiter:junit-jupiter")
dockerTestImplementation("org.mockito:mockito-core") dockerTestImplementation("org.mockito:mockito-core")
dockerTestImplementation("org.springframework:spring-test") dockerTestImplementation("org.springframework:spring-test")
dockerTestImplementation("org.testcontainers:couchbase")
dockerTestImplementation("org.testcontainers:junit-jupiter") dockerTestImplementation("org.testcontainers:junit-jupiter")
dockerTestImplementation("org.testcontainers:mongodb") dockerTestImplementation("org.testcontainers:mongodb")
dockerTestImplementation("org.testcontainers:testcontainers") dockerTestImplementation("org.testcontainers:testcontainers")
optional(project(":spring-boot-project:spring-boot-activemq")) optional(project(":spring-boot-project:spring-boot-activemq"))
optional(project(":spring-boot-project:spring-boot-artemis")) optional(project(":spring-boot-project:spring-boot-artemis"))
optional(project(":spring-boot-project:spring-boot-data-couchbase"))
optional(project(":spring-boot-project:spring-boot-data-jpa")) optional(project(":spring-boot-project:spring-boot-data-jpa"))
optional(project(":spring-boot-project:spring-boot-data-mongodb")) optional(project(":spring-boot-project:spring-boot-data-mongodb"))
optional(project(":spring-boot-project:spring-boot-data-redis")) optional(project(":spring-boot-project:spring-boot-data-redis"))
@ -67,7 +65,6 @@ dependencies {
optional("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") optional("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
optional("com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations") optional("com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations")
optional("com.fasterxml.jackson.module:jackson-module-parameter-names") optional("com.fasterxml.jackson.module:jackson-module-parameter-names")
optional("com.hazelcast:hazelcast-spring")
optional("com.nimbusds:oauth2-oidc-sdk") optional("com.nimbusds:oauth2-oidc-sdk")
optional("com.oracle.database.jdbc:ojdbc11") optional("com.oracle.database.jdbc:ojdbc11")
optional("com.oracle.database.jdbc:ucp11") optional("com.oracle.database.jdbc:ucp11")
@ -102,19 +99,12 @@ dependencies {
optional("org.apache.tomcat:tomcat-jdbc") optional("org.apache.tomcat:tomcat-jdbc")
optional("org.apiguardian:apiguardian-api") optional("org.apiguardian:apiguardian-api")
optional("org.eclipse.angus:angus-mail") optional("org.eclipse.angus:angus-mail")
optional("com.github.ben-manes.caffeine:caffeine")
optional("com.zaxxer:HikariCP") optional("com.zaxxer:HikariCP")
optional("org.aspectj:aspectjweaver") optional("org.aspectj:aspectjweaver")
optional("org.cache2k:cache2k-spring")
optional("org.eclipse.jetty.ee10:jetty-ee10-webapp") optional("org.eclipse.jetty.ee10:jetty-ee10-webapp")
optional("org.eclipse.jetty:jetty-reactive-httpclient") optional("org.eclipse.jetty:jetty-reactive-httpclient")
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-server") optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-server")
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server") optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server")
optional("org.ehcache:ehcache") {
artifact {
classifier = 'jakarta'
}
}
optional("org.glassfish.jersey.containers:jersey-container-servlet-core") optional("org.glassfish.jersey.containers:jersey-container-servlet-core")
optional("org.glassfish.jersey.containers:jersey-container-servlet") optional("org.glassfish.jersey.containers:jersey-container-servlet")
optional("org.glassfish.jersey.core:jersey-server") optional("org.glassfish.jersey.core:jersey-server")
@ -123,11 +113,6 @@ dependencies {
optional("org.hibernate.orm:hibernate-core") optional("org.hibernate.orm:hibernate-core")
optional("org.hibernate.orm:hibernate-jcache") optional("org.hibernate.orm:hibernate-jcache")
optional("org.hibernate.validator:hibernate-validator") optional("org.hibernate.validator:hibernate-validator")
optional("org.infinispan:infinispan-commons")
optional("org.infinispan:infinispan-component-annotations")
optional("org.infinispan:infinispan-core")
optional("org.infinispan:infinispan-jcache")
optional("org.infinispan:infinispan-spring6-embedded")
optional("org.influxdb:influxdb-java") optional("org.influxdb:influxdb-java")
optional("org.jooq:jooq") optional("org.jooq:jooq")
optional("org.liquibase:liquibase-core") { optional("org.liquibase:liquibase-core") {
@ -150,7 +135,6 @@ dependencies {
optional("org.springframework:spring-websocket") optional("org.springframework:spring-websocket")
optional("org.springframework:spring-webflux") optional("org.springframework:spring-webflux")
optional("org.springframework:spring-webmvc") optional("org.springframework:spring-webmvc")
optional("org.springframework.data:spring-data-couchbase")
optional("org.springframework.data:spring-data-envers") { optional("org.springframework.data:spring-data-envers") {
exclude group: "javax.activation", module: "javax.activation-api" exclude group: "javax.activation", module: "javax.activation-api"
exclude group: "javax.persistence", module: "javax.persistence-api" exclude group: "javax.persistence", module: "javax.persistence-api"

View File

@ -514,17 +514,6 @@
} }
], ],
"hints": [ "hints": [
{
"name": "spring.cache.jcache.provider",
"providers": [
{
"name": "class-reference",
"parameters": {
"target": "javax.cache.spi.CachingProvider"
}
}
]
},
{ {
"name": "spring.graphql.cors.allowed-headers", "name": "spring.graphql.cors.allowed-headers",
"values": [ "values": [

View File

@ -1,5 +1,4 @@
org.springframework.boot.autoconfigure.aop.AopAutoConfiguration org.springframework.boot.autoconfigure.aop.AopAutoConfiguration
org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration
org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration
org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration
org.springframework.boot.autoconfigure.graphql.data.GraphQlReactiveQueryByExampleAutoConfiguration org.springframework.boot.autoconfigure.graphql.data.GraphQlReactiveQueryByExampleAutoConfiguration

View File

@ -22,6 +22,7 @@ dependencies {
testFixturesCompileOnly(project(":spring-boot-project:spring-boot-test")) testFixturesCompileOnly(project(":spring-boot-project:spring-boot-test"))
testFixturesCompileOnly(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support")) testFixturesCompileOnly(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testFixturesCompileOnly("javax.cache:cache-api")
testFixturesCompileOnly("jakarta.websocket:jakarta.websocket-api") testFixturesCompileOnly("jakarta.websocket:jakarta.websocket-api")
testFixturesCompileOnly("jakarta.websocket:jakarta.websocket-client-api") testFixturesCompileOnly("jakarta.websocket:jakarta.websocket-client-api")

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@ package org.springframework.boot.autoconfigure.cache;
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Phillip Webb * @author Phillip Webb
* @author Eddú Meléndez * @author Eddú Meléndez
* @since 1.3.0 * @since 4.0.0
*/ */
public enum CacheType { public enum CacheType {

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Auto-configuration base classes for Caching support.
*/
package org.springframework.boot.autoconfigure.cache;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2024 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -0,0 +1,42 @@
plugins {
id "java-library"
id "org.springframework.boot.auto-configuration"
id "org.springframework.boot.configuration-properties"
id "org.springframework.boot.deployed"
id "org.springframework.boot.optional-dependencies"
}
description = "Spring Boot Cache"
dependencies {
api(project(":spring-boot-project:spring-boot"))
api("org.springframework:spring-context-support")
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
optional(project(":spring-boot-project:spring-boot-data-couchbase"))
optional(project(":spring-boot-project:spring-boot-data-redis"))
optional(project(":spring-boot-project:spring-boot-hazelcast"))
optional(project(":spring-boot-project:spring-boot-jpa"))
optional("com.hazelcast:hazelcast-spring")
optional("org.cache2k:cache2k-spring")
optional("javax.cache:cache-api")
optional("org.ehcache:ehcache") {
artifact {
classifier = 'jakarta'
}
}
optional("org.hibernate.orm:hibernate-core")
optional("org.hibernate.orm:hibernate-jcache")
optional("org.infinispan:infinispan-commons")
optional("org.infinispan:infinispan-component-annotations")
optional("org.infinispan:infinispan-core")
optional("org.infinispan:infinispan-jcache")
optional("org.infinispan:infinispan-spring6-embedded")
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure")))
testRuntimeOnly("ch.qos.logback:logback-classic")
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import org.cache2k.Cache2kBuilder; import org.cache2k.Cache2kBuilder;
@ -25,7 +25,7 @@ import org.cache2k.Cache2kBuilder;
* *
* @author Jens Wilke * @author Jens Wilke
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 2.7.0 * @since 4.0.0
*/ */
public interface Cache2kBuilderCustomizer { public interface Cache2kBuilderCustomizer {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.util.Collection; import java.util.Collection;
import java.util.function.Function; import java.util.function.Function;

View File

@ -14,17 +14,18 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration.CacheConfigurationImportSelector; import org.springframework.boot.autoconfigure.cache.CacheType;
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration.CacheManagerEntityManagerFactoryDependsOnConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration.CacheConfigurationImportSelector;
import org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration.CacheManagerEntityManagerFactoryDependsOnConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.jpa.autoconfigure.EntityManagerFactoryDependsOnPostProcessor; import org.springframework.boot.jpa.autoconfigure.EntityManagerFactoryDependsOnPostProcessor;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
@ -47,7 +48,7 @@ import org.springframework.util.Assert;
* Cache store can be auto-detected or specified explicitly through configuration. * Cache store can be auto-detected or specified explicitly through configuration.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.3.0 * @since 4.0.0
* @see EnableCaching * @see EnableCaching
*/ */
@AutoConfiguration(afterName = { "org.springframework.boot.data.couchbase.autoconfigure.CouchbaseDataAutoConfiguration", @AutoConfiguration(afterName = { "org.springframework.boot.data.couchbase.autoconfigure.CouchbaseDataAutoConfiguration",

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2024 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,8 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import org.springframework.boot.autoconfigure.cache.CacheType;
import org.springframework.boot.autoconfigure.condition.ConditionMessage; import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition; import org.springframework.boot.autoconfigure.condition.SpringBootCondition;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,12 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.util.Collections; import java.util.Collections;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.Map; import java.util.Map;
import org.springframework.boot.autoconfigure.cache.CacheType;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
@ -24,7 +24,7 @@ import org.springframework.cache.CacheManager;
* *
* @param <T> the type of the {@link CacheManager} * @param <T> the type of the {@link CacheManager}
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.3.3 * @since 4.0.0
*/ */
@FunctionalInterface @FunctionalInterface
public interface CacheManagerCustomizer<T extends CacheManager> { public interface CacheManagerCustomizer<T extends CacheManager> {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -28,7 +28,7 @@ import org.springframework.cache.CacheManager;
* given {@link CacheManager}. * given {@link CacheManager}.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.5.0 * @since 4.0.0
*/ */
public class CacheManagerCustomizers { public class CacheManagerCustomizers {

View File

@ -14,12 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.time.Duration; import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.springframework.boot.autoconfigure.cache.CacheType;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -30,7 +31,7 @@ import org.springframework.util.Assert;
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Eddú Meléndez * @author Eddú Meléndez
* @author Ryon Day * @author Ryon Day
* @since 1.3.0 * @since 4.0.0
*/ */
@ConfigurationProperties("spring.cache") @ConfigurationProperties("spring.cache")
public class CacheProperties { public class CacheProperties {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.util.List; import java.util.List;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
@ -22,10 +22,10 @@ import java.util.List;
import com.couchbase.client.java.Cluster; import com.couchbase.client.java.Cluster;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.cache.CacheProperties.Couchbase;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate; import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate;
import org.springframework.boot.cache.autoconfigure.CacheProperties.Couchbase;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Conditional;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import org.springframework.data.couchbase.cache.CouchbaseCacheManager; import org.springframework.data.couchbase.cache.CouchbaseCacheManager;
import org.springframework.data.couchbase.cache.CouchbaseCacheManager.CouchbaseCacheManagerBuilder; import org.springframework.data.couchbase.cache.CouchbaseCacheManager.CouchbaseCacheManagerBuilder;
@ -25,7 +25,7 @@ import org.springframework.data.couchbase.cache.CouchbaseCacheManager.CouchbaseC
* {@link CouchbaseCacheManager}. * {@link CouchbaseCacheManager}.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 2.3.3 * @since 4.0.0
*/ */
@FunctionalInterface @FunctionalInterface
public interface CouchbaseCacheManagerBuilderCustomizer { public interface CouchbaseCacheManagerBuilderCustomizer {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.util.Collection; import java.util.Collection;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.spring.cache.HazelcastCacheManager; import com.hazelcast.spring.cache.HazelcastCacheManager;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2024 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -41,7 +41,7 @@ import org.springframework.util.CollectionUtils;
* @author Eddú Meléndez * @author Eddú Meléndez
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Raja Kolli * @author Raja Kolli
* @since 1.3.0 * @since 4.0.0
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass(SpringEmbeddedCacheManager.class) @ConditionalOnClass(SpringEmbeddedCacheManager.class)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2024 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import javax.cache.CacheManager; import javax.cache.CacheManager;
@ -23,7 +23,7 @@ import javax.cache.CacheManager;
* manager before it is used, in particular to create additional caches. * manager before it is used, in particular to create additional caches.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.3.0 * @since 4.0.0
*/ */
@FunctionalInterface @FunctionalInterface
public interface JCacheManagerCustomizer { public interface JCacheManagerCustomizer {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2024 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.util.Properties; import java.util.Properties;
@ -26,7 +26,7 @@ import javax.cache.spi.CachingProvider;
* used by the {@link CachingProvider} to create the {@link CacheManager}. * used by the {@link CachingProvider} to create the {@link CacheManager}.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 3.4.0 * @since 4.0.0
* @see CachingProvider#getCacheManager(java.net.URI, ClassLoader, Properties) * @see CachingProvider#getCacheManager(java.net.URI, ClassLoader, Properties)
*/ */
public interface JCachePropertiesCustomizer { public interface JCachePropertiesCustomizer {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;

View File

@ -14,17 +14,17 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.cache.CacheProperties.Redis;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.cache.autoconfigure.CacheProperties.Redis;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Conditional;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import org.springframework.data.redis.cache.RedisCacheManager.RedisCacheManagerBuilder; import org.springframework.data.redis.cache.RedisCacheManager.RedisCacheManagerBuilder;
@ -22,7 +22,7 @@ import org.springframework.data.redis.cache.RedisCacheManager.RedisCacheManagerB
* Callback interface that can be used to customize a {@link RedisCacheManagerBuilder}. * Callback interface that can be used to customize a {@link RedisCacheManagerBuilder}.
* *
* @author Dmytro Nosan * @author Dmytro Nosan
* @since 2.2.0 * @since 4.0.0
*/ */
@FunctionalInterface @FunctionalInterface
public interface RedisCacheManagerBuilderCustomizer { public interface RedisCacheManagerBuilderCustomizer {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.util.List; import java.util.List;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,4 +17,4 @@
/** /**
* Auto-configuration for the cache abstraction. * Auto-configuration for the cache abstraction.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;

View File

@ -0,0 +1,17 @@
{
"groups": [],
"properties": [],
"hints": [
{
"name": "spring.cache.jcache.provider",
"providers": [
{
"name": "class-reference",
"parameters": {
"target": "javax.cache.spi.CachingProvider"
}
}
]
}
]
}

View File

@ -0,0 +1 @@
org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
@ -431,7 +431,7 @@ class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests {
@Test @Test
void jCacheCacheWithConfig() { void jCacheCacheWithConfig() {
String cachingProviderFqn = MockCachingProvider.class.getName(); String cachingProviderFqn = MockCachingProvider.class.getName();
String configLocation = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml"; String configLocation = "org/springframework/boot/cache/autoconfigure/hazelcast-specific.xml";
this.contextRunner.withUserConfiguration(JCacheCustomConfiguration.class) this.contextRunner.withUserConfiguration(JCacheCustomConfiguration.class)
.withPropertyValues("spring.cache.type=jcache", "spring.cache.jcache.provider=" + cachingProviderFqn, .withPropertyValues("spring.cache.type=jcache", "spring.cache.jcache.provider=" + cachingProviderFqn,
"spring.cache.jcache.config=" + configLocation) "spring.cache.jcache.config=" + configLocation)
@ -445,7 +445,7 @@ class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests {
@Test @Test
void jCacheCacheWithWrongConfig() { void jCacheCacheWithWrongConfig() {
String cachingProviderFqn = MockCachingProvider.class.getName(); String cachingProviderFqn = MockCachingProvider.class.getName();
String configLocation = "org/springframework/boot/autoconfigure/cache/does-not-exist.xml"; String configLocation = "org/springframework/boot/cache/autoconfigure/does-not-exist.xml";
this.contextRunner.withUserConfiguration(JCacheCustomConfiguration.class) this.contextRunner.withUserConfiguration(JCacheCustomConfiguration.class)
.withPropertyValues("spring.cache.type=jcache", "spring.cache.jcache.provider=" + cachingProviderFqn, .withPropertyValues("spring.cache.type=jcache", "spring.cache.jcache.provider=" + cachingProviderFqn,
"spring.cache.jcache.config=" + configLocation) "spring.cache.jcache.config=" + configLocation)
@ -519,7 +519,7 @@ class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests {
@Test @Test
void hazelcastCacheWithHazelcastAutoConfiguration() { void hazelcastCacheWithHazelcastAutoConfiguration() {
String hazelcastConfig = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml"; String hazelcastConfig = "org/springframework/boot/cache/autoconfigure/hazelcast-specific.xml";
this.contextRunner.withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class)) this.contextRunner.withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class))
.withUserConfiguration(DefaultCacheConfiguration.class) .withUserConfiguration(DefaultCacheConfiguration.class)
.withPropertyValues("spring.cache.type=hazelcast", "spring.hazelcast.config=" + hazelcastConfig) .withPropertyValues("spring.cache.type=hazelcast", "spring.hazelcast.config=" + hazelcastConfig)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.cache; package org.springframework.boot.cache.autoconfigure;
import org.ehcache.jsr107.EhcacheCachingProvider; import org.ehcache.jsr107.EhcacheCachingProvider;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.cache.CacheAutoConfigurationTests.DefaultCacheConfiguration; import org.springframework.boot.cache.autoconfigure.CacheAutoConfigurationTests.DefaultCacheConfiguration;
import org.springframework.boot.testsupport.classpath.ClassPathExclusions; import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.testsupport.classpath.resources.WithResource;
import org.springframework.cache.jcache.JCacheCacheManager; import org.springframework.cache.jcache.JCacheCacheManager;

View File

@ -0,0 +1,4 @@
#
# Test JSR 107 provider for testing purposes only.
#
org.springframework.boot.autoconfigure.cache.support.MockCachingProvider

View File

@ -0,0 +1,19 @@
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-5.0.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<queue name="foobar"/>
<map name="foobar">
<time-to-live-seconds>3600</time-to-live-seconds>
<max-idle-seconds>600</max-idle-seconds>
</map>
<network>
<join>
<auto-detection enabled="false" />
<multicast enabled="false"/>
</join>
</network>
</hazelcast>

View File

@ -2021,6 +2021,7 @@ bom {
"spring-boot-autoconfigure-processor", "spring-boot-autoconfigure-processor",
"spring-boot-batch", "spring-boot-batch",
"spring-boot-buildpack-platform", "spring-boot-buildpack-platform",
"spring-boot-cache",
"spring-boot-cassandra", "spring-boot-cassandra",
"spring-boot-configuration-metadata", "spring-boot-configuration-metadata",
"spring-boot-configuration-processor", "spring-boot-configuration-processor",

View File

@ -60,6 +60,7 @@ dependencies {
autoConfiguration(project(path: ":spring-boot-project:spring-boot-autoconfigure", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-autoconfigure", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-autoconfigure-all", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-autoconfigure-all", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-batch", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-batch", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-cache", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-cassandra", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-cassandra", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-couchbase", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-couchbase", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-data-cassandra", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-data-cassandra", configuration: "autoConfigurationMetadata"))
@ -123,6 +124,7 @@ dependencies {
configurationProperties(project(path: ":spring-boot-project:spring-boot-autoconfigure", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-autoconfigure", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-autoconfigure-all", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-autoconfigure-all", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-batch", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-batch", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-cache", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-cassandra", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-cassandra", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-couchbase", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-couchbase", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-data-cassandra", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-data-cassandra", configuration: "configurationPropertiesMetadata"))
@ -183,6 +185,7 @@ dependencies {
implementation(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure")) implementation(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure"))
implementation(project(path: ":spring-boot-project:spring-boot-amqp")) implementation(project(path: ":spring-boot-project:spring-boot-amqp"))
implementation(project(path: ":spring-boot-project:spring-boot-autoconfigure-all")) implementation(project(path: ":spring-boot-project:spring-boot-autoconfigure-all"))
implementation(project(path: ":spring-boot-project:spring-boot-cache"))
implementation(project(path: ":spring-boot-project:spring-boot-data-cassandra")) implementation(project(path: ":spring-boot-project:spring-boot-data-cassandra"))
implementation(project(path: ":spring-boot-project:spring-boot-data-elasticsearch")) implementation(project(path: ":spring-boot-project:spring-boot-data-elasticsearch"))
implementation(project(path: ":spring-boot-project:spring-boot-data-neo4j")) implementation(project(path: ":spring-boot-project:spring-boot-data-neo4j"))

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2021 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@
package org.springframework.boot.docs.io.caching.provider; package org.springframework.boot.docs.io.caching.provider;
import org.springframework.boot.autoconfigure.cache.CacheManagerCustomizer; import org.springframework.boot.cache.autoconfigure.CacheManagerCustomizer;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager; import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,7 +18,7 @@ package org.springframework.boot.docs.io.caching.provider.cache2k;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.springframework.boot.autoconfigure.cache.Cache2kBuilderCustomizer; import org.springframework.boot.cache.autoconfigure.Cache2kBuilderCustomizer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,7 +18,7 @@ package org.springframework.boot.docs.io.caching.provider.couchbase;
import java.time.Duration; import java.time.Duration;
import org.springframework.boot.autoconfigure.cache.CouchbaseCacheManagerBuilderCustomizer; import org.springframework.boot.cache.autoconfigure.CouchbaseCacheManagerBuilderCustomizer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.couchbase.cache.CouchbaseCacheConfiguration; import org.springframework.data.couchbase.cache.CouchbaseCacheConfiguration;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2021 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,7 +18,7 @@ package org.springframework.boot.docs.io.caching.provider.redis;
import java.time.Duration; import java.time.Duration;
import org.springframework.boot.autoconfigure.cache.RedisCacheManagerBuilderCustomizer; import org.springframework.boot.cache.autoconfigure.RedisCacheManagerBuilderCustomizer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheConfiguration;

View File

@ -16,7 +16,7 @@
package org.springframework.boot.docs.io.caching.provider package org.springframework.boot.docs.io.caching.provider
import org.springframework.boot.autoconfigure.cache.CacheManagerCustomizer import org.springframework.boot.cache.autoconfigure.CacheManagerCustomizer
import org.springframework.cache.concurrent.ConcurrentMapCacheManager import org.springframework.cache.concurrent.ConcurrentMapCacheManager
import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Configuration

View File

@ -1,6 +1,6 @@
package org.springframework.boot.docs.io.caching.provider.cache2k package org.springframework.boot.docs.io.caching.provider.cache2k
import org.springframework.boot.autoconfigure.cache.Cache2kBuilderCustomizer import org.springframework.boot.cache.autoconfigure.Cache2kBuilderCustomizer
import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Configuration
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit

View File

@ -16,7 +16,7 @@
package org.springframework.boot.docs.io.caching.provider.couchbase package org.springframework.boot.docs.io.caching.provider.couchbase
import org.springframework.boot.autoconfigure.cache.CouchbaseCacheManagerBuilderCustomizer import org.springframework.boot.cache.autoconfigure.CouchbaseCacheManagerBuilderCustomizer
import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Configuration
import org.springframework.data.couchbase.cache.CouchbaseCacheConfiguration import org.springframework.data.couchbase.cache.CouchbaseCacheConfiguration

View File

@ -16,7 +16,7 @@
package org.springframework.boot.docs.io.caching.provider.redis package org.springframework.boot.docs.io.caching.provider.redis
import org.springframework.boot.autoconfigure.cache.RedisCacheManagerBuilderCustomizer import org.springframework.boot.cache.autoconfigure.RedisCacheManagerBuilderCustomizer
import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Configuration
import org.springframework.data.redis.cache.RedisCacheConfiguration import org.springframework.data.redis.cache.RedisCacheConfiguration

View File

@ -6,5 +6,5 @@ description = "Starter for using Spring Framework's caching support"
dependencies { dependencies {
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter")) api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter"))
api("org.springframework:spring-context-support") api(project(":spring-boot-project:spring-boot-cache"))
} }

View File

@ -36,6 +36,7 @@ dependencies {
dockerTestRuntimeOnly("io.lettuce:lettuce-core") dockerTestRuntimeOnly("io.lettuce:lettuce-core")
dockerTestRuntimeOnly("org.springframework.data:spring-data-redis") dockerTestRuntimeOnly("org.springframework.data:spring-data-redis")
optional(project(":spring-boot-project:spring-boot-cache"))
optional(project(":spring-boot-project:spring-boot-data-cassandra")) optional(project(":spring-boot-project:spring-boot-data-cassandra"))
optional(project(":spring-boot-project:spring-boot-data-couchbase")) optional(project(":spring-boot-project:spring-boot-data-couchbase"))
optional(project(":spring-boot-project:spring-boot-data-elasticsearch")) optional(project(":spring-boot-project:spring-boot-data-elasticsearch"))

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,2 +1,2 @@
# AutoConfigureCache auto-configuration imports # AutoConfigureCache auto-configuration imports
org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration optional:org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration

View File

@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration; import org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration;
import org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration; import org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration;
import org.springframework.boot.liquibase.autoconfigure.LiquibaseAutoConfiguration; import org.springframework.boot.liquibase.autoconfigure.LiquibaseAutoConfiguration;
import org.springframework.boot.test.autoconfigure.orm.jpa.ExampleComponent; import org.springframework.boot.test.autoconfigure.orm.jpa.ExampleComponent;