Skip to content

Commit 1ee127a

Browse files
snicollwilkinsona
authored andcommitted
Create spring-boot-cache module
1 parent d82ad48 commit 1ee127a

File tree

62 files changed

+187
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+187
-119
lines changed

Diff for: settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ include "spring-boot-project:spring-boot-artemis"
5050
include "spring-boot-project:spring-boot-autoconfigure"
5151
include "spring-boot-project:spring-boot-autoconfigure-all"
5252
include "spring-boot-project:spring-boot-batch"
53+
include "spring-boot-project:spring-boot-cache"
5354
include "spring-boot-project:spring-boot-cassandra"
5455
include "spring-boot-project:spring-boot-couchbase"
5556
include "spring-boot-project:spring-boot-data-cassandra"

Diff for: spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies {
2020
optional(project(":spring-boot-project:spring-boot-activemq"))
2121
optional(project(":spring-boot-project:spring-boot-amqp"))
2222
optional(project(":spring-boot-project:spring-boot-artemis"))
23+
optional(project(":spring-boot-project:spring-boot-cache"))
2324
optional(project(":spring-boot-project:spring-boot-couchbase"))
2425
optional(project(":spring-boot-project:spring-boot-data-cassandra"))
2526
optional(project(":spring-boot-project:spring-boot-data-elasticsearch"))

Diff for: spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfiguration.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.springframework.boot.actuate.cache.CachesEndpointWebExtension;
2525
import org.springframework.boot.autoconfigure.AutoConfiguration;
2626
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
27-
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration;
2827
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
2928
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3029
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -38,7 +37,7 @@
3837
* @author Stephane Nicoll
3938
* @since 2.1.0
4039
*/
41-
@AutoConfiguration(after = CacheAutoConfiguration.class)
40+
@AutoConfiguration(afterName = "org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration")
4241
@ConditionalOnClass(CacheManager.class)
4342
@ConditionalOnAvailableEndpoint(CachesEndpoint.class)
4443
public class CachesEndpointAutoConfiguration {

Diff for: spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsAutoConfiguration.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
1919
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;
2020
import org.springframework.boot.autoconfigure.AutoConfiguration;
2121
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
22-
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration;
2322
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
2423
import org.springframework.cache.Cache;
2524
import org.springframework.cache.CacheManager;
@@ -32,7 +31,8 @@
3231
* @author Stephane Nicoll
3332
* @since 2.0.0
3433
*/
35-
@AutoConfiguration(after = { MetricsAutoConfiguration.class, CacheAutoConfiguration.class })
34+
@AutoConfiguration(after = MetricsAutoConfiguration.class,
35+
afterName = "org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration")
3636
@ConditionalOnBean(CacheManager.class)
3737
@Import({ CacheMeterBinderProvidersConfiguration.class, CacheMetricsRegistrarConfiguration.class })
3838
public class CacheMetricsAutoConfiguration {

Diff for: spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
2727
import org.springframework.boot.autoconfigure.AutoConfigurations;
28-
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration;
28+
import org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration;
2929
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
3030
import org.springframework.cache.CacheManager;
3131
import org.springframework.cache.annotation.CachingConfigurer;

Diff for: spring-boot-project/spring-boot-actuator/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies {
1212
api(project(":spring-boot-project:spring-boot-all"))
1313

1414
dockerTestImplementation(project(":spring-boot-project:spring-boot-autoconfigure-all"))
15+
dockerTestImplementation(project(":spring-boot-project:spring-boot-cache"))
1516
dockerTestImplementation(project(":spring-boot-project:spring-boot-neo4j"))
1617
dockerTestImplementation(project(":spring-boot-project:spring-boot-test"))
1718
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker"))

Diff for: spring-boot-project/spring-boot-actuator/src/dockerTest/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMetricsTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import org.testcontainers.junit.jupiter.Testcontainers;
2929

3030
import org.springframework.boot.autoconfigure.AutoConfigurations;
31-
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration;
31+
import org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration;
3232
import org.springframework.boot.data.redis.autoconfigure.RedisAutoConfiguration;
3333
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
3434
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

Diff for: spring-boot-project/spring-boot-autoconfigure-all/build.gradle

-16
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ dependencies {
3333
dockerTestImplementation("org.junit.jupiter:junit-jupiter")
3434
dockerTestImplementation("org.mockito:mockito-core")
3535
dockerTestImplementation("org.springframework:spring-test")
36-
dockerTestImplementation("org.testcontainers:couchbase")
3736
dockerTestImplementation("org.testcontainers:junit-jupiter")
3837
dockerTestImplementation("org.testcontainers:mongodb")
3938
dockerTestImplementation("org.testcontainers:testcontainers")
4039

4140
optional(project(":spring-boot-project:spring-boot-activemq"))
4241
optional(project(":spring-boot-project:spring-boot-artemis"))
43-
optional(project(":spring-boot-project:spring-boot-data-couchbase"))
4442
optional(project(":spring-boot-project:spring-boot-data-jpa"))
4543
optional(project(":spring-boot-project:spring-boot-data-mongodb"))
4644
optional(project(":spring-boot-project:spring-boot-data-redis"))
@@ -67,7 +65,6 @@ dependencies {
6765
optional("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
6866
optional("com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations")
6967
optional("com.fasterxml.jackson.module:jackson-module-parameter-names")
70-
optional("com.hazelcast:hazelcast-spring")
7168
optional("com.nimbusds:oauth2-oidc-sdk")
7269
optional("com.oracle.database.jdbc:ojdbc11")
7370
optional("com.oracle.database.jdbc:ucp11")
@@ -102,19 +99,12 @@ dependencies {
10299
optional("org.apache.tomcat:tomcat-jdbc")
103100
optional("org.apiguardian:apiguardian-api")
104101
optional("org.eclipse.angus:angus-mail")
105-
optional("com.github.ben-manes.caffeine:caffeine")
106102
optional("com.zaxxer:HikariCP")
107103
optional("org.aspectj:aspectjweaver")
108-
optional("org.cache2k:cache2k-spring")
109104
optional("org.eclipse.jetty.ee10:jetty-ee10-webapp")
110105
optional("org.eclipse.jetty:jetty-reactive-httpclient")
111106
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-server")
112107
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server")
113-
optional("org.ehcache:ehcache") {
114-
artifact {
115-
classifier = 'jakarta'
116-
}
117-
}
118108
optional("org.glassfish.jersey.containers:jersey-container-servlet-core")
119109
optional("org.glassfish.jersey.containers:jersey-container-servlet")
120110
optional("org.glassfish.jersey.core:jersey-server")
@@ -123,11 +113,6 @@ dependencies {
123113
optional("org.hibernate.orm:hibernate-core")
124114
optional("org.hibernate.orm:hibernate-jcache")
125115
optional("org.hibernate.validator:hibernate-validator")
126-
optional("org.infinispan:infinispan-commons")
127-
optional("org.infinispan:infinispan-component-annotations")
128-
optional("org.infinispan:infinispan-core")
129-
optional("org.infinispan:infinispan-jcache")
130-
optional("org.infinispan:infinispan-spring6-embedded")
131116
optional("org.influxdb:influxdb-java")
132117
optional("org.jooq:jooq") {
133118
exclude group: "javax.xml.bind", module: "jaxb-api"
@@ -152,7 +137,6 @@ dependencies {
152137
optional("org.springframework:spring-websocket")
153138
optional("org.springframework:spring-webflux")
154139
optional("org.springframework:spring-webmvc")
155-
optional("org.springframework.data:spring-data-couchbase")
156140
optional("org.springframework.data:spring-data-envers") {
157141
exclude group: "javax.activation", module: "javax.activation-api"
158142
exclude group: "javax.persistence", module: "javax.persistence-api"

Diff for: spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json

-11
Original file line numberDiff line numberDiff line change
@@ -514,17 +514,6 @@
514514
}
515515
],
516516
"hints": [
517-
{
518-
"name": "spring.cache.jcache.provider",
519-
"providers": [
520-
{
521-
"name": "class-reference",
522-
"parameters": {
523-
"target": "javax.cache.spi.CachingProvider"
524-
}
525-
}
526-
]
527-
},
528517
{
529518
"name": "spring.graphql.cors.allowed-headers",
530519
"values": [

Diff for: spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
org.springframework.boot.autoconfigure.aop.AopAutoConfiguration
2-
org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration
32
org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration
43
org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration
54
org.springframework.boot.autoconfigure.graphql.data.GraphQlReactiveQueryByExampleAutoConfiguration

Diff for: spring-boot-project/spring-boot-autoconfigure/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies {
2222

2323
testFixturesCompileOnly(project(":spring-boot-project:spring-boot-test"))
2424
testFixturesCompileOnly(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
25+
testFixturesCompileOnly("javax.cache:cache-api")
2526
testFixturesCompileOnly("jakarta.websocket:jakarta.websocket-api")
2627
testFixturesCompileOnly("jakarta.websocket:jakarta.websocket-client-api")
2728

Diff for: spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/cache/CacheType.java renamed to spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheType.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
2222
* @author Stephane Nicoll
2323
* @author Phillip Webb
2424
* @author Eddú Meléndez
25-
* @since 1.3.0
25+
* @since 4.0.0
2626
*/
2727
public enum CacheType {
2828

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2012-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Auto-configuration base classes for Caching support.
19+
*/
20+
package org.springframework.boot.autoconfigure.cache;
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

Diff for: spring-boot-project/spring-boot-cache/build.gradle

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
plugins {
2+
id "java-library"
3+
id "org.springframework.boot.auto-configuration"
4+
id "org.springframework.boot.configuration-properties"
5+
id "org.springframework.boot.deployed"
6+
id "org.springframework.boot.optional-dependencies"
7+
}
8+
9+
description = "Spring Boot Cache"
10+
11+
dependencies {
12+
api(project(":spring-boot-project:spring-boot"))
13+
api("org.springframework:spring-context-support")
14+
15+
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
16+
optional(project(":spring-boot-project:spring-boot-data-couchbase"))
17+
optional(project(":spring-boot-project:spring-boot-data-redis"))
18+
optional(project(":spring-boot-project:spring-boot-hazelcast"))
19+
optional(project(":spring-boot-project:spring-boot-jpa"))
20+
optional("com.hazelcast:hazelcast-spring")
21+
optional("org.cache2k:cache2k-spring")
22+
optional("javax.cache:cache-api")
23+
optional("org.ehcache:ehcache") {
24+
artifact {
25+
classifier = 'jakarta'
26+
}
27+
}
28+
29+
optional("org.hibernate.orm:hibernate-core")
30+
optional("org.hibernate.orm:hibernate-jcache")
31+
optional("org.infinispan:infinispan-commons")
32+
optional("org.infinispan:infinispan-component-annotations")
33+
optional("org.infinispan:infinispan-core")
34+
optional("org.infinispan:infinispan-jcache")
35+
optional("org.infinispan:infinispan-spring6-embedded")
36+
37+
testImplementation(project(":spring-boot-project:spring-boot-test"))
38+
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
39+
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure")))
40+
41+
testRuntimeOnly("ch.qos.logback:logback-classic")
42+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.cache;
17+
package org.springframework.boot.cache.autoconfigure;
1818

1919
import org.cache2k.Cache2kBuilder;
2020

@@ -25,7 +25,7 @@
2525
*
2626
* @author Jens Wilke
2727
* @author Stephane Nicoll
28-
* @since 2.7.0
28+
* @since 4.0.0
2929
*/
3030
public interface Cache2kBuilderCustomizer {
3131

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.cache;
17+
package org.springframework.boot.cache.autoconfigure;
1818

1919
import java.util.Collection;
2020
import java.util.function.Function;
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.cache;
17+
package org.springframework.boot.cache.autoconfigure;
1818

1919
import org.springframework.beans.factory.InitializingBean;
2020
import org.springframework.beans.factory.ObjectProvider;
2121
import org.springframework.boot.autoconfigure.AutoConfiguration;
2222
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
23-
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration.CacheConfigurationImportSelector;
24-
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration.CacheManagerEntityManagerFactoryDependsOnConfiguration;
23+
import org.springframework.boot.autoconfigure.cache.CacheType;
2524
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
2625
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2726
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
27+
import org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration.CacheConfigurationImportSelector;
28+
import org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration.CacheManagerEntityManagerFactoryDependsOnConfiguration;
2829
import org.springframework.boot.context.properties.EnableConfigurationProperties;
2930
import org.springframework.boot.jpa.autoconfigure.EntityManagerFactoryDependsOnPostProcessor;
3031
import org.springframework.cache.CacheManager;
@@ -47,7 +48,7 @@
4748
* Cache store can be auto-detected or specified explicitly through configuration.
4849
*
4950
* @author Stephane Nicoll
50-
* @since 1.3.0
51+
* @since 4.0.0
5152
* @see EnableCaching
5253
*/
5354
@AutoConfiguration(afterName = { "org.springframework.boot.data.couchbase.autoconfigure.CouchbaseDataAutoConfiguration",
+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,8 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.cache;
17+
package org.springframework.boot.cache.autoconfigure;
1818

19+
import org.springframework.boot.autoconfigure.cache.CacheType;
1920
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
2021
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
2122
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,12 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.cache;
17+
package org.springframework.boot.cache.autoconfigure;
1818

1919
import java.util.Collections;
2020
import java.util.EnumMap;
2121
import java.util.Map;
2222

23+
import org.springframework.boot.autoconfigure.cache.CacheType;
2324
import org.springframework.util.Assert;
2425

2526
/**

0 commit comments

Comments
 (0)