From adec7f2df2dd2e7244c38b690f796235f91b4ce3 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 9 May 2025 09:33:02 +0100 Subject: [PATCH] Move code from spring-boot-actuator to spring-boot-cache --- .../CachesEndpointAutoConfiguration.java | 6 ++-- ...acheMeterBinderProvidersConfiguration.java | 16 +++++----- .../cache/CacheMetricsAutoConfiguration.java | 3 ++ .../CacheMetricsRegistrarConfiguration.java | 4 +-- .../CachesEndpointAutoConfigurationTests.java | 6 ++-- .../spring-boot-actuator-docs/build.gradle | 3 +- .../CachesEndpointDocumentationTests.java | 4 +-- .../spring-boot-actuator/build.gradle | 15 +++++++-- .../actuate/endpoint/web/test/PortHolder.java | 31 ------------------- .../endpoint/web/test/WebEndpointTest.java | 0 ...EndpointTestInvocationContextProvider.java | 14 +++++++++ .../spring-boot-cache/build.gradle | 13 +++++++- .../metrics}/RedisCacheMetricsTests.java | 2 +- .../actuate/endpoint}/CachesEndpoint.java | 4 +-- .../endpoint}/CachesEndpointWebExtension.java | 6 ++-- .../endpoint}/NonUniqueCacheException.java | 6 ++-- .../cache/actuate/endpoint}/package-info.java | 6 ++-- .../Cache2kCacheMeterBinderProvider.java | 6 ++-- .../metrics}/CacheMeterBinderProvider.java | 6 ++-- .../metrics}/CacheMetricsRegistrar.java | 6 ++-- .../CaffeineCacheMeterBinderProvider.java | 6 ++-- .../HazelcastCacheMeterBinderProvider.java | 8 ++--- .../JCacheCacheMeterBinderProvider.java | 6 ++-- .../RedisCacheMeterBinderProvider.java | 6 ++-- .../actuate/metrics}/RedisCacheMetrics.java | 6 ++-- .../cache/actuate/metrics}/package-info.java | 6 ++-- .../endpoint}/CachesEndpointTests.java | 8 ++--- .../CachesEndpointWebIntegrationTests.java | 4 +-- .../Cache2kCacheMeterBinderProviderTests.java | 2 +- .../metrics}/CacheMetricsRegistrarTests.java | 4 +-- ...CaffeineCacheMeterBinderProviderTests.java | 4 +-- ...azelcastCacheMeterBinderProviderTests.java | 4 +-- .../JCacheCacheMeterBinderProviderTests.java | 4 +-- .../RedisCacheMeterBinderProviderTests.java | 4 +-- 34 files changed, 118 insertions(+), 111 deletions(-) delete mode 100644 spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/PortHolder.java rename spring-boot-project/spring-boot-actuator/src/{test => testFixtures}/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTest.java (100%) rename spring-boot-project/spring-boot-actuator/src/{test => testFixtures}/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java (98%) rename spring-boot-project/{spring-boot-actuator/src/dockerTest/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/dockerTest/java/org/springframework/boot/cache/actuate/metrics}/RedisCacheMetricsTests.java (99%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint}/CachesEndpoint.java (99%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint}/CachesEndpointWebExtension.java (93%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint}/NonUniqueCacheException.java (91%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint}/package-info.java (79%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics}/Cache2kCacheMeterBinderProvider.java (90%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics}/CacheMeterBinderProvider.java (91%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics}/CacheMetricsRegistrar.java (96%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics}/CaffeineCacheMeterBinderProvider.java (90%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics}/HazelcastCacheMeterBinderProvider.java (94%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics}/JCacheCacheMeterBinderProvider.java (89%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics}/RedisCacheMeterBinderProvider.java (89%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics}/RedisCacheMetrics.java (95%) rename spring-boot-project/{spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache => spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics}/package-info.java (81%) rename spring-boot-project/{spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cache => spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/endpoint}/CachesEndpointTests.java (96%) rename spring-boot-project/{spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cache => spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/endpoint}/CachesEndpointWebIntegrationTests.java (97%) rename spring-boot-project/{spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics}/Cache2kCacheMeterBinderProviderTests.java (96%) rename spring-boot-project/{spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics}/CacheMetricsRegistrarTests.java (95%) rename spring-boot-project/{spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics}/CaffeineCacheMeterBinderProviderTests.java (92%) rename spring-boot-project/{spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics}/HazelcastCacheMeterBinderProviderTests.java (95%) rename spring-boot-project/{spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics}/JCacheCacheMeterBinderProviderTests.java (94%) rename spring-boot-project/{spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache => spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics}/RedisCacheMeterBinderProviderTests.java (92%) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfiguration.java index d9f4215f4c..85b6108810 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfiguration.java @@ -20,13 +20,13 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.support.SimpleAutowireCandidateResolver; import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint; import org.springframework.boot.actuate.autoconfigure.endpoint.expose.EndpointExposure; -import org.springframework.boot.actuate.cache.CachesEndpoint; -import org.springframework.boot.actuate.cache.CachesEndpointWebExtension; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.cache.actuate.endpoint.CachesEndpoint; +import org.springframework.boot.cache.actuate.endpoint.CachesEndpointWebExtension; import org.springframework.cache.CacheManager; import org.springframework.context.annotation.Bean; @@ -38,7 +38,7 @@ import org.springframework.context.annotation.Bean; * @since 2.1.0 */ @AutoConfiguration(afterName = "org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration") -@ConditionalOnClass(CacheManager.class) +@ConditionalOnClass({ CacheManager.class, CachesEndpoint.class }) @ConditionalOnAvailableEndpoint(CachesEndpoint.class) public class CachesEndpointAutoConfiguration { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMeterBinderProvidersConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMeterBinderProvidersConfiguration.java index fd72d69d0a..0728f83b98 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMeterBinderProvidersConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMeterBinderProvidersConfiguration.java @@ -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"); * you may not use this file except in compliance with the License. @@ -23,13 +23,13 @@ import org.cache2k.Cache2kBuilder; import org.cache2k.extra.micrometer.Cache2kCacheMetrics; import org.cache2k.extra.spring.SpringCache2kCache; -import org.springframework.boot.actuate.metrics.cache.Cache2kCacheMeterBinderProvider; -import org.springframework.boot.actuate.metrics.cache.CacheMeterBinderProvider; -import org.springframework.boot.actuate.metrics.cache.CaffeineCacheMeterBinderProvider; -import org.springframework.boot.actuate.metrics.cache.HazelcastCacheMeterBinderProvider; -import org.springframework.boot.actuate.metrics.cache.JCacheCacheMeterBinderProvider; -import org.springframework.boot.actuate.metrics.cache.RedisCacheMeterBinderProvider; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.cache.actuate.metrics.Cache2kCacheMeterBinderProvider; +import org.springframework.boot.cache.actuate.metrics.CacheMeterBinderProvider; +import org.springframework.boot.cache.actuate.metrics.CaffeineCacheMeterBinderProvider; +import org.springframework.boot.cache.actuate.metrics.HazelcastCacheMeterBinderProvider; +import org.springframework.boot.cache.actuate.metrics.JCacheCacheMeterBinderProvider; +import org.springframework.boot.cache.actuate.metrics.RedisCacheMeterBinderProvider; import org.springframework.cache.caffeine.CaffeineCache; import org.springframework.cache.jcache.JCacheCache; import org.springframework.context.annotation.Bean; @@ -42,7 +42,7 @@ import org.springframework.data.redis.cache.RedisCache; * @author Stephane Nicoll */ @Configuration(proxyBeanMethods = false) -@ConditionalOnClass(MeterBinder.class) +@ConditionalOnClass({ MeterBinder.class, CacheMeterBinderProvider.class }) class CacheMeterBinderProvidersConfiguration { @Configuration(proxyBeanMethods = false) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsAutoConfiguration.java index 37c17bf3f6..0fda840c88 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsAutoConfiguration.java @@ -20,6 +20,8 @@ import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfigu import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.cache.actuate.metrics.CacheMetricsRegistrar; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.context.annotation.Import; @@ -34,6 +36,7 @@ import org.springframework.context.annotation.Import; @AutoConfiguration(after = MetricsAutoConfiguration.class, afterName = "org.springframework.boot.cache.autoconfigure.CacheAutoConfiguration") @ConditionalOnBean(CacheManager.class) +@ConditionalOnClass(CacheMetricsRegistrar.class) @Import({ CacheMeterBinderProvidersConfiguration.class, CacheMetricsRegistrarConfiguration.class }) public class CacheMetricsAutoConfiguration { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsRegistrarConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsRegistrarConfiguration.java index fd8e8de5f3..899e04bfed 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsRegistrarConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMetricsRegistrarConfiguration.java @@ -24,9 +24,9 @@ import io.micrometer.core.instrument.Tag; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.support.SimpleAutowireCandidateResolver; -import org.springframework.boot.actuate.metrics.cache.CacheMeterBinderProvider; -import org.springframework.boot.actuate.metrics.cache.CacheMetricsRegistrar; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.cache.actuate.metrics.CacheMeterBinderProvider; +import org.springframework.boot.cache.actuate.metrics.CacheMetricsRegistrar; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.context.annotation.Bean; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfigurationTests.java index 77766f4c3b..6373c4f7de 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfigurationTests.java @@ -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"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package org.springframework.boot.actuate.autoconfigure.cache; import org.junit.jupiter.api.Test; -import org.springframework.boot.actuate.cache.CachesEndpoint; -import org.springframework.boot.actuate.cache.CachesEndpointWebExtension; import org.springframework.boot.autoconfigure.AutoConfigurations; +import org.springframework.boot.cache.actuate.endpoint.CachesEndpoint; +import org.springframework.boot.cache.actuate.endpoint.CachesEndpointWebExtension; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.cache.CacheManager; diff --git a/spring-boot-project/spring-boot-actuator-docs/build.gradle b/spring-boot-project/spring-boot-actuator-docs/build.gradle index 3b2a03370a..b50ad7c89a 100644 --- a/spring-boot-project/spring-boot-actuator-docs/build.gradle +++ b/spring-boot-project/spring-boot-actuator-docs/build.gradle @@ -7,8 +7,9 @@ description = "Spring Boot Actuator Docs" dependencies { testImplementation(project(":spring-boot-project:spring-boot-actuator-autoconfigure")) - testImplementation(project(":spring-boot-project:spring-boot-http-converter")) + testImplementation(project(":spring-boot-project:spring-boot-cache")) testImplementation(project(":spring-boot-project:spring-boot-flyway")) + testImplementation(project(":spring-boot-project:spring-boot-http-converter")) testImplementation(project(":spring-boot-project:spring-boot-integration")) testImplementation(project(":spring-boot-project:spring-boot-jackson")) testImplementation(project(":spring-boot-project:spring-boot-jdbc")) diff --git a/spring-boot-project/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/cache/CachesEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/cache/CachesEndpointDocumentationTests.java index 7721792776..a7efbbd045 100644 --- a/spring-boot-project/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/cache/CachesEndpointDocumentationTests.java +++ b/spring-boot-project/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/cache/CachesEndpointDocumentationTests.java @@ -23,9 +23,9 @@ import java.util.Map; import org.junit.jupiter.api.Test; -import org.springframework.boot.actuate.cache.CachesEndpoint; -import org.springframework.boot.actuate.cache.CachesEndpointWebExtension; import org.springframework.boot.actuate.docs.MockMvcEndpointDocumentationTests; +import org.springframework.boot.cache.actuate.endpoint.CachesEndpoint; +import org.springframework.boot.cache.actuate.endpoint.CachesEndpointWebExtension; import org.springframework.cache.CacheManager; import org.springframework.cache.concurrent.ConcurrentMapCacheManager; import org.springframework.context.annotation.Bean; diff --git a/spring-boot-project/spring-boot-actuator/build.gradle b/spring-boot-project/spring-boot-actuator/build.gradle index 4ef10e6912..fe43adb1f5 100644 --- a/spring-boot-project/spring-boot-actuator/build.gradle +++ b/spring-boot-project/spring-boot-actuator/build.gradle @@ -1,5 +1,6 @@ plugins { id "java-library" + id "java-test-fixtures" id "org.springframework.boot.configuration-properties" id "org.springframework.boot.optional-dependencies" id "org.springframework.boot.docker-test" @@ -12,7 +13,6 @@ dependencies { api(project(":spring-boot-project:spring-boot")) 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-test")) dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker")) @@ -60,8 +60,6 @@ dependencies { optional("javax.cache:cache-api") optional("org.apache.tomcat.embed:tomcat-embed-core") optional("org.aspectj:aspectjweaver") - optional("org.cache2k:cache2k-micrometer") - optional("org.cache2k:cache2k-spring") optional("org.eclipse.angus:angus-mail") optional("org.eclipse.jetty:jetty-server") { exclude(group: "org.eclipse.jetty.toolchain", module: "jetty-jakarta-servlet-api") @@ -94,6 +92,17 @@ dependencies { optional("org.springframework.security:spring-security-web") optional("org.springframework.session:spring-session-core") + testFixturesImplementation(project(":spring-boot-project:spring-boot-autoconfigure")) + testFixturesImplementation(project(":spring-boot-project:spring-boot-http-converter")) + testFixturesImplementation(project(":spring-boot-project:spring-boot-jackson")) + testFixturesImplementation(project(":spring-boot-project:spring-boot-jersey")) + testFixturesImplementation(project(":spring-boot-project:spring-boot-reactor-netty")) + testFixturesImplementation(project(":spring-boot-project:spring-boot-test")) + testFixturesImplementation(project(":spring-boot-project:spring-boot-tomcat")) + testFixturesImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support")) + testFixturesImplementation(project(":spring-boot-project:spring-boot-webflux")) + testFixturesImplementation(project(":spring-boot-project:spring-boot-webmvc")) + testImplementation(project(":spring-boot-project:spring-boot-autoconfigure-all")) testImplementation(project(":spring-boot-project:spring-boot-hazelcast")) testImplementation(project(":spring-boot-project:spring-boot-jackson")) diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/PortHolder.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/PortHolder.java deleted file mode 100644 index bb9ead658c..0000000000 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/PortHolder.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2012-2019 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. - */ - -package org.springframework.boot.actuate.endpoint.web.test; - -public class PortHolder { - - private int port; - - int getPort() { - return this.port; - } - - void setPort(int port) { - this.port = port; - } - -} diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTest.java b/spring-boot-project/spring-boot-actuator/src/testFixtures/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTest.java similarity index 100% rename from spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTest.java rename to spring-boot-project/spring-boot-actuator/src/testFixtures/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTest.java diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java b/spring-boot-project/spring-boot-actuator/src/testFixtures/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java similarity index 98% rename from spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java rename to spring-boot-project/spring-boot-actuator/src/testFixtures/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java index 91d6c155c7..8f0b514091 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/testFixtures/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java @@ -326,4 +326,18 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation } + private static final class PortHolder { + + private int port; + + private int getPort() { + return this.port; + } + + private void setPort(int port) { + this.port = port; + } + + } + } diff --git a/spring-boot-project/spring-boot-cache/build.gradle b/spring-boot-project/spring-boot-cache/build.gradle index 251c0df7ca..109b4210ad 100644 --- a/spring-boot-project/spring-boot-cache/build.gradle +++ b/spring-boot-project/spring-boot-cache/build.gradle @@ -3,6 +3,7 @@ plugins { id "org.springframework.boot.auto-configuration" id "org.springframework.boot.configuration-properties" id "org.springframework.boot.deployed" + id "org.springframework.boot.docker-test" id "org.springframework.boot.optional-dependencies" } @@ -12,14 +13,17 @@ dependencies { api(project(":spring-boot-project:spring-boot")) api("org.springframework:spring-context-support") + optional(project(":spring-boot-project:spring-boot-actuator")) 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("io.micrometer:micrometer-core") optional("javax.cache:cache-api") + optional("org.cache2k:cache2k-micrometer") + optional("org.cache2k:cache2k-spring") optional("org.ehcache:ehcache") { artifact { classifier = 'jakarta' @@ -33,8 +37,15 @@ dependencies { optional("org.infinispan:infinispan-jcache") optional("org.infinispan:infinispan-spring6-embedded") + dockerTestImplementation(project(":spring-boot-project:spring-boot-test")) + dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker")) + dockerTestImplementation("com.redis:testcontainers-redis") + dockerTestImplementation("org.testcontainers:junit-jupiter") + dockerTestImplementation("org.testcontainers:testcontainers") + 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-actuator"))) testImplementation(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure"))) testRuntimeOnly("ch.qos.logback:logback-classic") diff --git a/spring-boot-project/spring-boot-actuator/src/dockerTest/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMetricsTests.java b/spring-boot-project/spring-boot-cache/src/dockerTest/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMetricsTests.java similarity index 99% rename from spring-boot-project/spring-boot-actuator/src/dockerTest/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMetricsTests.java rename to spring-boot-project/spring-boot-cache/src/dockerTest/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMetricsTests.java index e363532def..b0e6fe71f6 100644 --- a/spring-boot-project/spring-boot-actuator/src/dockerTest/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMetricsTests.java +++ b/spring-boot-project/spring-boot-cache/src/dockerTest/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMetricsTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import java.util.UUID; import java.util.function.BiConsumer; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/CachesEndpoint.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpoint.java similarity index 99% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/CachesEndpoint.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpoint.java index f62e3fd81f..a6568ecc3f 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/CachesEndpoint.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpoint.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.cache; +package org.springframework.boot.cache.actuate.endpoint; import java.util.LinkedHashMap; import java.util.List; @@ -36,7 +36,7 @@ import org.springframework.cache.CacheManager; * * @author Johannes Edmeier * @author Stephane Nicoll - * @since 2.1.0 + * @since 4.0.0 */ @Endpoint(id = "caches") public class CachesEndpoint { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/CachesEndpointWebExtension.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpointWebExtension.java similarity index 93% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/CachesEndpointWebExtension.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpointWebExtension.java index d2007f402c..9c76bace20 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/CachesEndpointWebExtension.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpointWebExtension.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package org.springframework.boot.actuate.cache; +package org.springframework.boot.cache.actuate.endpoint; -import org.springframework.boot.actuate.cache.CachesEndpoint.CacheEntryDescriptor; import org.springframework.boot.actuate.endpoint.annotation.DeleteOperation; import org.springframework.boot.actuate.endpoint.annotation.OptionalParameter; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.actuate.endpoint.annotation.Selector; import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse; import org.springframework.boot.actuate.endpoint.web.annotation.EndpointWebExtension; +import org.springframework.boot.cache.actuate.endpoint.CachesEndpoint.CacheEntryDescriptor; /** * {@link EndpointWebExtension @EndpointWebExtension} for the {@link CachesEndpoint}. * * @author Stephane Nicoll - * @since 2.1.0 + * @since 4.0.0 */ @EndpointWebExtension(endpoint = CachesEndpoint.class) public class CachesEndpointWebExtension { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/NonUniqueCacheException.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/NonUniqueCacheException.java similarity index 91% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/NonUniqueCacheException.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/NonUniqueCacheException.java index eb0debbd76..bf34edbb33 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/NonUniqueCacheException.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/NonUniqueCacheException.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.cache; +package org.springframework.boot.cache.actuate.endpoint; import java.util.Collection; import java.util.Collections; @@ -23,7 +23,7 @@ import java.util.Collections; * Exception thrown when multiple caches exist with the same name. * * @author Stephane Nicoll - * @since 2.1.0 + * @since 4.0.0 */ public class NonUniqueCacheException extends RuntimeException { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/package-info.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/package-info.java similarity index 79% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/package-info.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/package-info.java index bc1a0e261c..b54e93a4c3 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/package-info.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/package-info.java @@ -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"); * you may not use this file except in compliance with the License. @@ -15,6 +15,6 @@ */ /** - * Actuator support for cache metrics. + * Actuator endpoint for caches. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.endpoint; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/Cache2kCacheMeterBinderProvider.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/Cache2kCacheMeterBinderProvider.java similarity index 90% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/Cache2kCacheMeterBinderProvider.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/Cache2kCacheMeterBinderProvider.java index d2954b4b46..2bd1372307 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/Cache2kCacheMeterBinderProvider.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/Cache2kCacheMeterBinderProvider.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.MeterBinder; @@ -25,7 +25,7 @@ import org.cache2k.extra.spring.SpringCache2kCache; * {@link CacheMeterBinderProvider} implementation for cache2k. * * @author Jens Wilke - * @since 2.7.0 + * @since 4.0.0 */ public class Cache2kCacheMeterBinderProvider implements CacheMeterBinderProvider { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CacheMeterBinderProvider.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/CacheMeterBinderProvider.java similarity index 91% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CacheMeterBinderProvider.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/CacheMeterBinderProvider.java index a920b46968..1e4704cc0e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CacheMeterBinderProvider.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/CacheMeterBinderProvider.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.MeterBinder; @@ -26,7 +26,7 @@ import org.springframework.cache.Cache; * * @param the cache type * @author Stephane Nicoll - * @since 2.0.0 + * @since 4.0.0 */ @FunctionalInterface public interface CacheMeterBinderProvider { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CacheMetricsRegistrar.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/CacheMetricsRegistrar.java similarity index 96% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CacheMetricsRegistrar.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/CacheMetricsRegistrar.java index fb5d05acb0..9625c4d488 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CacheMetricsRegistrar.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/CacheMetricsRegistrar.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import java.util.Collection; import java.util.Objects; @@ -33,7 +33,7 @@ import org.springframework.util.ClassUtils; * Register supported {@link Cache} to a {@link MeterRegistry}. * * @author Stephane Nicoll - * @since 2.0.0 + * @since 4.0.0 */ public class CacheMetricsRegistrar { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProvider.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/CaffeineCacheMeterBinderProvider.java similarity index 90% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProvider.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/CaffeineCacheMeterBinderProvider.java index 120bb2a06a..2135b27b0f 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProvider.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/CaffeineCacheMeterBinderProvider.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.MeterBinder; @@ -26,7 +26,7 @@ import org.springframework.cache.caffeine.CaffeineCache; * {@link CacheMeterBinderProvider} implementation for Caffeine. * * @author Stephane Nicoll - * @since 2.0.0 + * @since 4.0.0 */ public class CaffeineCacheMeterBinderProvider implements CacheMeterBinderProvider { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProvider.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/HazelcastCacheMeterBinderProvider.java similarity index 94% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProvider.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/HazelcastCacheMeterBinderProvider.java index ce331b3cc0..43ff0a4430 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProvider.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/HazelcastCacheMeterBinderProvider.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import java.lang.reflect.Constructor; import java.lang.reflect.Method; @@ -27,7 +27,7 @@ import io.micrometer.core.instrument.binder.cache.HazelcastCacheMetrics; import org.springframework.aot.hint.ExecutableMode; import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.RuntimeHintsRegistrar; -import org.springframework.boot.actuate.metrics.cache.HazelcastCacheMeterBinderProvider.HazelcastCacheMeterBinderProviderRuntimeHints; +import org.springframework.boot.cache.actuate.metrics.HazelcastCacheMeterBinderProvider.HazelcastCacheMeterBinderProviderRuntimeHints; import org.springframework.context.annotation.ImportRuntimeHints; import org.springframework.util.Assert; import org.springframework.util.ReflectionUtils; @@ -36,7 +36,7 @@ import org.springframework.util.ReflectionUtils; * {@link CacheMeterBinderProvider} implementation for Hazelcast. * * @author Stephane Nicoll - * @since 2.0.0 + * @since 4.0.0 */ @ImportRuntimeHints(HazelcastCacheMeterBinderProviderRuntimeHints.class) public class HazelcastCacheMeterBinderProvider implements CacheMeterBinderProvider { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProvider.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/JCacheCacheMeterBinderProvider.java similarity index 89% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProvider.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/JCacheCacheMeterBinderProvider.java index 32550e45f8..f31a117812 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProvider.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/JCacheCacheMeterBinderProvider.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.MeterBinder; @@ -26,7 +26,7 @@ import org.springframework.cache.jcache.JCacheCache; * {@link CacheMeterBinderProvider} implementation for JCache. * * @author Stephane Nicoll - * @since 2.0.0 + * @since 4.0.0 */ public class JCacheCacheMeterBinderProvider implements CacheMeterBinderProvider { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMeterBinderProvider.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMeterBinderProvider.java similarity index 89% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMeterBinderProvider.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMeterBinderProvider.java index a31aea3807..c7c6f8829e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMeterBinderProvider.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMeterBinderProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.MeterBinder; @@ -25,7 +25,7 @@ import org.springframework.data.redis.cache.RedisCache; * {@link CacheMeterBinderProvider} implementation for Redis. * * @author Stephane Nicoll - * @since 2.4.0 + * @since 4.0.0 */ public class RedisCacheMeterBinderProvider implements CacheMeterBinderProvider { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMetrics.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMetrics.java similarity index 95% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMetrics.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMetrics.java index a9469484d6..44ed425716 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMetrics.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMetrics.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import java.util.concurrent.TimeUnit; @@ -30,7 +30,7 @@ import org.springframework.data.redis.cache.RedisCache; * {@link CacheMeterBinder} for {@link RedisCache}. * * @author Stephane Nicoll - * @since 2.4.0 + * @since 4.0.0 */ public class RedisCacheMetrics extends CacheMeterBinder { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/package-info.java b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/package-info.java similarity index 81% rename from spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/package-info.java rename to spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/package-info.java index a7ff0c8ecf..866e6bd01e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/package-info.java +++ b/spring-boot-project/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/metrics/package-info.java @@ -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"); * you may not use this file except in compliance with the License. @@ -15,6 +15,6 @@ */ /** - * Actuator support for caches. + * Metrics for caches. */ -package org.springframework.boot.actuate.cache; +package org.springframework.boot.cache.actuate.metrics; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cache/CachesEndpointTests.java b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpointTests.java similarity index 96% rename from spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cache/CachesEndpointTests.java rename to spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpointTests.java index f87ed86969..7fae82ffba 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cache/CachesEndpointTests.java +++ b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpointTests.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.cache; +package org.springframework.boot.cache.actuate.endpoint; import java.util.Arrays; import java.util.Collections; @@ -24,8 +24,8 @@ import java.util.concurrent.ConcurrentHashMap; import org.junit.jupiter.api.Test; -import org.springframework.boot.actuate.cache.CachesEndpoint.CacheEntryDescriptor; -import org.springframework.boot.actuate.cache.CachesEndpoint.CacheManagerDescriptor; +import org.springframework.boot.cache.actuate.endpoint.CachesEndpoint.CacheEntryDescriptor; +import org.springframework.boot.cache.actuate.endpoint.CachesEndpoint.CacheManagerDescriptor; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.cache.concurrent.ConcurrentMapCacheManager; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cache/CachesEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpointWebIntegrationTests.java similarity index 97% rename from spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cache/CachesEndpointWebIntegrationTests.java rename to spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpointWebIntegrationTests.java index 28f4742c87..099df356ab 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cache/CachesEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpointWebIntegrationTests.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.cache; +package org.springframework.boot.cache.actuate.endpoint; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/Cache2kCacheMeterBinderProviderTests.java b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/Cache2kCacheMeterBinderProviderTests.java similarity index 96% rename from spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/Cache2kCacheMeterBinderProviderTests.java rename to spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/Cache2kCacheMeterBinderProviderTests.java index aeb2f79952..ff404f8bcd 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/Cache2kCacheMeterBinderProviderTests.java +++ b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/Cache2kCacheMeterBinderProviderTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import java.util.Collections; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CacheMetricsRegistrarTests.java b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/CacheMetricsRegistrarTests.java similarity index 95% rename from spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CacheMetricsRegistrarTests.java rename to spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/CacheMetricsRegistrarTests.java index e0894f539d..23b4df8507 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CacheMetricsRegistrarTests.java +++ b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/CacheMetricsRegistrarTests.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import java.util.Collections; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProviderTests.java b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/CaffeineCacheMeterBinderProviderTests.java similarity index 92% rename from spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProviderTests.java rename to spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/CaffeineCacheMeterBinderProviderTests.java index bca5ce345b..25ddeb5161 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProviderTests.java +++ b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/CaffeineCacheMeterBinderProviderTests.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import java.util.Collections; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProviderTests.java b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/HazelcastCacheMeterBinderProviderTests.java similarity index 95% rename from spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProviderTests.java rename to spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/HazelcastCacheMeterBinderProviderTests.java index 6fe5e6fb20..6fdaaac11c 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProviderTests.java +++ b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/HazelcastCacheMeterBinderProviderTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import java.util.Collections; @@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test; import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; -import org.springframework.boot.actuate.metrics.cache.HazelcastCacheMeterBinderProvider.HazelcastCacheMeterBinderProviderRuntimeHints; +import org.springframework.boot.cache.actuate.metrics.HazelcastCacheMeterBinderProvider.HazelcastCacheMeterBinderProviderRuntimeHints; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProviderTests.java b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/JCacheCacheMeterBinderProviderTests.java similarity index 94% rename from spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProviderTests.java rename to spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/JCacheCacheMeterBinderProviderTests.java index 919dc5bb06..809ad946bd 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProviderTests.java +++ b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/JCacheCacheMeterBinderProviderTests.java @@ -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"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import java.net.URI; import java.net.URISyntaxException; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMeterBinderProviderTests.java b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMeterBinderProviderTests.java similarity index 92% rename from spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMeterBinderProviderTests.java rename to spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMeterBinderProviderTests.java index 0565602686..44a9e9e0fb 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMeterBinderProviderTests.java +++ b/spring-boot-project/spring-boot-cache/src/test/java/org/springframework/boot/cache/actuate/metrics/RedisCacheMeterBinderProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.cache; +package org.springframework.boot.cache.actuate.metrics; import java.util.Collections;