Skip to content

Adapt to restructuring changes in Spring Boot 4.0 #1940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions spring-cloud-kubernetes-client-autoconfig/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-health</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2024 the original author or authors.
* Copyright 2013-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.
Expand All @@ -18,8 +18,8 @@

import io.kubernetes.client.openapi.models.V1Pod;

import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.autoconfigure.info.ConditionalOnEnabledInfoContributor;
import org.springframework.boot.health.autoconfigure.contributor.ConditionalOnEnabledHealthIndicator;
import org.springframework.cloud.kubernetes.commons.PodUtils;
import org.springframework.cloud.kubernetes.commons.autoconfig.ConditionalOnKubernetesHealthIndicatorEnabled;
import org.springframework.context.annotation.Bean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-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.
Expand All @@ -20,9 +20,9 @@
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
import org.springframework.boot.health.registry.ReactiveHealthContributorRegistry;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.cloud.kubernetes.client.example.App;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2024 the original author or authors.
* Copyright 2013-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.
Expand Down Expand Up @@ -30,8 +30,8 @@
import org.mockito.Mockito;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.health.contributor.Health;
import org.springframework.boot.health.contributor.Status;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.cloud.kubernetes.client.example.App;
Expand Down Expand Up @@ -67,7 +67,7 @@ void afterEach() {

@Test
void test() throws ApiException {
Health health = healthIndicator.getHealth(true);
Health health = healthIndicator.health(true);
Assertions.assertThat(Status.DOWN).isSameAs(health.getStatus());
Mockito.verify(coreV1Api).readNamespacedPod("host", "my-namespace", null);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-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.
Expand All @@ -20,9 +20,9 @@
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
import org.springframework.boot.health.registry.HealthContributorRegistry;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.cloud.kubernetes.client.example.App;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;
Expand All @@ -37,7 +37,7 @@ class ActuatorEnabledHealthTest {
private WebTestClient webClient;

@Autowired
private ReactiveHealthContributorRegistry registry;
private HealthContributorRegistry registry;

@LocalManagementPort
private int port;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2024 the original author or authors.
* Copyright 2013-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.
Expand Down Expand Up @@ -30,8 +30,8 @@
import org.mockito.Mockito;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.health.contributor.Health;
import org.springframework.boot.health.contributor.Status;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.cloud.kubernetes.client.example.App;
Expand Down Expand Up @@ -70,7 +70,7 @@ void afterEach() {
// This is not a real case we have, it just makes sure
@Test
void test() throws ApiException {
Health health = healthIndicator.getHealth(true);
Health health = healthIndicator.health(true);
Assertions.assertThat(Status.UP).isSameAs(health.getStatus());
Mockito.verify(coreV1Api).readNamespacedPod("host", "my-namespace", null);
}
Expand Down
5 changes: 5 additions & 0 deletions spring-cloud-kubernetes-client-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-health</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2023 the original author or authors.
* Copyright 2013-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.
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.springframework.cloud.kubernetes.client.config.boostrap.stubs;
package org.springframework.cloud.kubernetes.client.config.bootstrap.stubs;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2023 the original author or authors.
* Copyright 2013-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.
Expand All @@ -22,7 +22,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.SanitizableData;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand All @@ -34,7 +34,7 @@ class BootstrapKubernetesClientSanitizeConfigpropsEndpointTests {
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SanitizeApp.class,
properties = { "spring.main.cloud-platform=KUBERNETES", "spring.cloud.bootstrap.enabled=true",
"management.endpoints.web.exposure.include=*", "spring.cloud.bootstrap.name=sanitize",
"bootstrap.sanitize=true", "spring.cloud.kubernetes.client.namespace=test" })
"bootstrap.sanitize=true", "spring.cloud.kubernetes.client.namespace=test", "debug=true" })
@Nested
class DefaultSettingsTest {

Expand All @@ -47,7 +47,7 @@ class DefaultSettingsTest {
@Test
void test() {
// configmap is sanitized
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/actuator/configprops", this.port)
.accept(MediaType.APPLICATION_JSON)
.exchange()
Expand All @@ -56,7 +56,7 @@ void test() {
.isEqualTo(SanitizableData.SANITIZED_VALUE);

// secret is sanitized
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/actuator/configprops", this.port)
.accept(MediaType.APPLICATION_JSON)
.exchange()
Expand All @@ -65,7 +65,7 @@ void test() {
.isEqualTo(SanitizableData.SANITIZED_VALUE);

// secret is usable from configuration properties
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/secret", this.port)
.exchange()
.expectStatus()
Expand All @@ -75,7 +75,7 @@ void test() {
.isEqualTo("sanitizeSecretValue");

// configmap is usable from configuration properties
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/configmap", this.port)
.exchange()
.expectStatus()
Expand Down Expand Up @@ -105,7 +105,7 @@ class ExplicitNever {
@Test
void test() {
// configmap is sanitized
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/actuator/configprops", this.port)
.accept(MediaType.APPLICATION_JSON)
.exchange()
Expand All @@ -116,7 +116,7 @@ void test() {
.isEqualTo(SanitizableData.SANITIZED_VALUE);

// secret is sanitized
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/actuator/configprops", this.port)
.accept(MediaType.APPLICATION_JSON)
.exchange()
Expand All @@ -127,7 +127,7 @@ void test() {
.isEqualTo(SanitizableData.SANITIZED_VALUE);

// secret is usable from configuration properties
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/secret", this.port)
.exchange()
.expectStatus()
Expand All @@ -137,7 +137,7 @@ void test() {
.isEqualTo("sanitizeSecretValue");

// configmap is usable from configuration properties
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/configmap", this.port)
.exchange()
.expectStatus()
Expand Down Expand Up @@ -177,7 +177,7 @@ class AlwaysWithoutSanitizingFunction {
@Test
void test() {
// configmap is not sanitized
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/actuator/configprops", this.port)
.accept(MediaType.APPLICATION_JSON)
.exchange()
Expand All @@ -188,7 +188,7 @@ void test() {
.isEqualTo("sanitizeConfigMapValue");

// secret is not sanitized
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/actuator/configprops", this.port)
.accept(MediaType.APPLICATION_JSON)
.exchange()
Expand All @@ -199,7 +199,7 @@ void test() {
.isEqualTo("sanitizeSecretValue");

// secret is usable from configuration properties
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/secret", this.port)
.exchange()
.expectStatus()
Expand All @@ -209,7 +209,7 @@ void test() {
.isEqualTo("sanitizeSecretValue");

// configmap is usable from configuration properties
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/configmap", this.port)
.exchange()
.expectStatus()
Expand Down Expand Up @@ -249,7 +249,7 @@ class AlwaysWithSanitizingFunction {
@Test
void test() {
// configmap is not sanitized
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/actuator/configprops", this.port)
.accept(MediaType.APPLICATION_JSON)
.exchange()
Expand All @@ -260,7 +260,7 @@ void test() {
.isEqualTo("sanitizeConfigMapValue");

// first secret is sanitized
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/actuator/configprops", this.port)
.accept(MediaType.APPLICATION_JSON)
.exchange()
Expand All @@ -271,7 +271,7 @@ void test() {
.isEqualTo(SanitizableData.SANITIZED_VALUE);

// second secret is sanitized
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/actuator/configprops", this.port)
.accept(MediaType.APPLICATION_JSON)
.exchange()
Expand All @@ -282,7 +282,7 @@ void test() {
.isEqualTo(SanitizableData.SANITIZED_VALUE);

// secret is usable from configuration properties
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/secret", this.port)
.exchange()
.expectStatus()
Expand All @@ -292,7 +292,7 @@ void test() {
.isEqualTo("sanitizeSecretValue");

// configmap is usable from configuration properties
webClient.get()
this.webClient.get()
.uri("http://localhost:{port}/configmap", this.port)
.exchange()
.expectStatus()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2023 the original author or authors.
* Copyright 2013-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.
Expand All @@ -22,7 +22,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.SanitizableData;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2023 the original author or authors.
* Copyright 2013-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.
Expand All @@ -22,7 +22,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.SanitizableData;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2023 the original author or authors.
* Copyright 2013-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.
Expand All @@ -22,7 +22,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.SanitizableData;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalManagementPort;
import org.springframework.boot.web.server.test.LocalManagementPort;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2023 the original author or authors.
* Copyright 2013-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.
Expand Down Expand Up @@ -28,7 +28,7 @@

import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static org.mockito.Mockito.mockStatic;
import static org.springframework.cloud.kubernetes.client.config.boostrap.stubs.BootstrapKubernetesClientSanitizeEnvEndpointStub.stubData;
import static org.springframework.cloud.kubernetes.client.config.bootstrap.stubs.BootstrapKubernetesClientSanitizeEnvEndpointStub.stubData;

/**
* @author wind57
Expand Down
Loading
Loading