Skip to content

Commit 7c2b625

Browse files
committed
Create spring-boot-cloudfoundry module
1 parent 0b69e89 commit 7c2b625

File tree

59 files changed

+278
-168
lines changed

Some content is hidden

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

59 files changed

+278
-168
lines changed

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ include "spring-boot-project:spring-boot-autoconfigure"
5252
include "spring-boot-project:spring-boot-batch"
5353
include "spring-boot-project:spring-boot-cache"
5454
include "spring-boot-project:spring-boot-cassandra"
55+
include "spring-boot-project:spring-boot-cloudfoundry"
5556
include "spring-boot-project:spring-boot-couchbase"
5657
include "spring-boot-project:spring-boot-data-cassandra"
5758
include "spring-boot-project:spring-boot-data-commons"

spring-boot-project/spring-boot-actuator-autoconfigure-all/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ dependencies {
104104
testImplementation(project(":spring-boot-project:spring-boot-web-server-test"))
105105
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-metrics")))
106106
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-web-server")))
107+
testImplementation("com.squareup.okhttp3:mockwebserver")
107108
testImplementation("io.micrometer:micrometer-observation-test")
108109
testImplementation("io.micrometer:micrometer-registry-prometheus")
109110
testImplementation("io.opentelemetry:opentelemetry-exporter-common")
110111
testImplementation("io.projectreactor:reactor-test")
111112
testImplementation("io.prometheus:prometheus-metrics-exposition-formats")
112-
testImplementation("com.squareup.okhttp3:mockwebserver")
113113
testImplementation("jakarta.xml.bind:jakarta.xml.bind-api")
114114
testImplementation("org.apache.activemq:artemis-jakarta-client")
115115
testImplementation("org.apache.activemq:artemis-jakarta-server")

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive.ReactiveCloudFoundryActuatorAutoConfiguration
2-
org.springframework.boot.actuate.autoconfigure.cloudfoundry.servlet.CloudFoundryActuatorAutoConfiguration
31
org.springframework.boot.actuate.autoconfigure.security.reactive.ReactiveManagementWebSecurityAutoConfiguration
42
org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration
53
org.springframework.boot.actuate.autoconfigure.tracing.BraveAutoConfiguration
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Endpoint Exposure Outcome Contributors
2-
org.springframework.boot.actuate.autoconfigure.endpoint.condition.EndpointExposureOutcomeContributor=\
3-
org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryEndpointExposureOutcomeContributor
4-
51
# Failure Analyzers
62
org.springframework.boot.diagnostics.FailureAnalyzer=\
73
org.springframework.boot.actuate.autoconfigure.health.NoSuchHealthContributorFailureAnalyzer

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnAvailableEndpointTests.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,6 @@ void outcomeWithNoEndpointReferenceShouldFail() {
229229
});
230230
}
231231

232-
@Test
233-
void outcomeOnCloudFoundryShouldMatchAll() {
234-
this.contextRunner.withPropertyValues("VCAP_APPLICATION:---")
235-
.run((context) -> assertThat(context).hasBean("info").hasBean("health").hasBean("spring").hasBean("test"));
236-
}
237-
238232
@Test // gh-21044
239233
void outcomeWhenIncludeAllShouldMatchDashedEndpoint() {
240234
this.contextRunner.withUserConfiguration(DashedEndpointConfiguration.class)

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/sbom/SbomEndpointAutoConfigurationTests.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ void runWhenWebExposedShouldHaveEndpointBeanAndWebExtension() {
4242
.hasSingleBean(SbomEndpointWebExtension.class));
4343
}
4444

45-
@Test
46-
void runWhenCloudFoundryExposedShouldHaveEndpointBeanAndWebExtension() {
47-
this.contextRunner
48-
.withPropertyValues("management.endpoints.cloud-foundry.exposure.include=sbom",
49-
"spring.main.cloud-platform=cloud_foundry")
50-
.run((context) -> assertThat(context).hasSingleBean(SbomEndpoint.class)
51-
.hasSingleBean(SbomEndpointWebExtension.class));
52-
}
53-
5445
@Test
5546
void runWhenNotExposedShouldNotHaveEndpointBean() {
5647
this.contextRunner.run((context) -> assertThat(context).doesNotHaveBean(SbomEndpoint.class));
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
plugins {
2+
id "java-library"
3+
id "org.springframework.boot.auto-configuration"
4+
id "org.springframework.boot.deployed"
5+
id "org.springframework.boot.optional-dependencies"
6+
}
7+
8+
description = "Spring Boot Cloud Foundry"
9+
10+
dependencies {
11+
api(project(":spring-boot-project:spring-boot"))
12+
api(project(":spring-boot-project:spring-boot-actuator"))
13+
api(project(":spring-boot-project:spring-boot-actuator-autoconfigure"))
14+
15+
implementation(project(":spring-boot-project:spring-boot-security"))
16+
17+
optional(project(":spring-boot-project:spring-boot-restclient"))
18+
optional(project(":spring-boot-project:spring-boot-webclient"))
19+
optional(project(":spring-boot-project:spring-boot-webflux"))
20+
optional(project(":spring-boot-project:spring-boot-webmvc"))
21+
optional("io.projectreactor:reactor-core")
22+
optional("io.projectreactor.netty:reactor-netty-http")
23+
optional("jakarta.servlet:jakarta.servlet-api")
24+
25+
testImplementation(project(":spring-boot-project:spring-boot-http-converter"))
26+
testImplementation(project(":spring-boot-project:spring-boot-jackson"))
27+
testImplementation(project(":spring-boot-project:spring-boot-reactor-netty"))
28+
testImplementation(project(":spring-boot-project:spring-boot-restclient-test"))
29+
testImplementation(project(":spring-boot-project:spring-boot-test"))
30+
testImplementation(project(":spring-boot-project:spring-boot-tomcat"))
31+
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
32+
testImplementation("com.squareup.okhttp3:mockwebserver")
33+
testImplementation("io.projectreactor:reactor-test")
34+
35+
testRuntimeOnly("ch.qos.logback:logback-classic")
36+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry;
17+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure;
1818

1919
import java.util.Arrays;
2020
import java.util.List;
@@ -24,7 +24,7 @@
2424
* endpoints.
2525
*
2626
* @author Madhura Bhave
27-
* @since 2.0.0
27+
* @since 4.0.0
2828
*/
2929
public enum AccessLevel {
3030

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry;
17+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure;
1818

1919
import org.springframework.http.HttpStatus;
2020

2121
/**
2222
* Authorization exceptions thrown to limit access to the endpoints.
2323
*
2424
* @author Madhura Bhave
25-
* @since 2.0.0
25+
* @since 4.0.0
2626
*/
2727
public class CloudFoundryAuthorizationException extends RuntimeException {
2828

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry;
17+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure;
1818

1919
import java.util.Set;
2020

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry;
17+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure;
1818

1919
import org.springframework.boot.actuate.endpoint.EndpointFilter;
2020
import org.springframework.boot.actuate.endpoint.annotation.DiscovererEndpointFilter;
Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry;
17+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure;
1818

1919
import java.util.Collection;
20-
import java.util.Collections;
2120
import java.util.List;
2221

2322
import org.springframework.aot.hint.MemberCategory;
2423
import org.springframework.aot.hint.RuntimeHints;
2524
import org.springframework.aot.hint.RuntimeHintsRegistrar;
26-
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryWebEndpointDiscoverer.CloudFoundryWebEndpointDiscovererRuntimeHints;
2725
import org.springframework.boot.actuate.endpoint.EndpointFilter;
2826
import org.springframework.boot.actuate.endpoint.OperationFilter;
2927
import org.springframework.boot.actuate.endpoint.invoke.OperationInvokerAdvisor;
@@ -35,6 +33,7 @@
3533
import org.springframework.boot.actuate.endpoint.web.annotation.EndpointWebExtension;
3634
import org.springframework.boot.actuate.endpoint.web.annotation.WebEndpointDiscoverer;
3735
import org.springframework.boot.actuate.health.HealthEndpoint;
36+
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.CloudFoundryWebEndpointDiscoverer.CloudFoundryWebEndpointDiscovererRuntimeHints;
3837
import org.springframework.context.ApplicationContext;
3938
import org.springframework.context.annotation.ImportRuntimeHints;
4039
import org.springframework.core.annotation.MergedAnnotations;
@@ -44,31 +43,11 @@
4443
* extensions for the {@link HealthEndpoint}.
4544
*
4645
* @author Madhura Bhave
47-
* @since 2.0.0
46+
* @since 4.0.0
4847
*/
4948
@ImportRuntimeHints(CloudFoundryWebEndpointDiscovererRuntimeHints.class)
5049
public class CloudFoundryWebEndpointDiscoverer extends WebEndpointDiscoverer {
5150

52-
/**
53-
* Create a new {@link WebEndpointDiscoverer} instance.
54-
* @param applicationContext the source application context
55-
* @param parameterValueMapper the parameter value mapper
56-
* @param endpointMediaTypes the endpoint media types
57-
* @param endpointPathMappers the endpoint path mappers
58-
* @param invokerAdvisors invoker advisors to apply
59-
* @param endpointFilters endpoint filters to apply
60-
* @deprecated since 3.4.0 for removal in 4.0.0 in favor of
61-
* {@link #CloudFoundryWebEndpointDiscoverer(ApplicationContext, ParameterValueMapper, EndpointMediaTypes, List, Collection, Collection, Collection)}
62-
*/
63-
@Deprecated(since = "3.4.0", forRemoval = true)
64-
public CloudFoundryWebEndpointDiscoverer(ApplicationContext applicationContext,
65-
ParameterValueMapper parameterValueMapper, EndpointMediaTypes endpointMediaTypes,
66-
List<PathMapper> endpointPathMappers, Collection<OperationInvokerAdvisor> invokerAdvisors,
67-
Collection<EndpointFilter<ExposableWebEndpoint>> endpointFilters) {
68-
this(applicationContext, parameterValueMapper, endpointMediaTypes, endpointPathMappers, invokerAdvisors,
69-
endpointFilters, Collections.emptyList());
70-
}
71-
7251
/**
7352
* Create a new {@link WebEndpointDiscoverer} instance.
7453
* @param applicationContext the source application context
@@ -78,7 +57,6 @@ public CloudFoundryWebEndpointDiscoverer(ApplicationContext applicationContext,
7857
* @param invokerAdvisors invoker advisors to apply
7958
* @param endpointFilters endpoint filters to apply
8059
* @param operationFilters operation filters to apply
81-
* @since 3.4.0
8260
*/
8361
public CloudFoundryWebEndpointDiscoverer(ApplicationContext applicationContext,
8462
ParameterValueMapper parameterValueMapper, EndpointMediaTypes endpointMediaTypes,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry;
17+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure;
1818

1919
import java.lang.annotation.Documented;
2020
import java.lang.annotation.ElementType;
@@ -32,7 +32,7 @@
3232
*
3333
* @author Phillip Webb
3434
* @author Madhura Bhave
35-
* @since 2.2.0
35+
* @since 4.0.0
3636
*/
3737
@Target(ElementType.TYPE)
3838
@Retention(RetentionPolicy.RUNTIME)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry;
17+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure;
1818

1919
import org.springframework.http.HttpStatus;
2020

2121
/**
2222
* Response from the Cloud Foundry security interceptors.
2323
*
2424
* @author Madhura Bhave
25-
* @since 2.0.0
25+
* @since 4.0.0
2626
*/
2727
public class SecurityResponse {
2828

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry;
17+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure;
1818

1919
import java.nio.charset.StandardCharsets;
2020
import java.util.Base64;
2121
import java.util.List;
2222
import java.util.Map;
2323

24-
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryAuthorizationException.Reason;
24+
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.CloudFoundryAuthorizationException.Reason;
2525
import org.springframework.boot.json.JsonParserFactory;
2626
import org.springframework.util.StringUtils;
2727

2828
/**
2929
* The JSON web token provided with each request that originates from Cloud Foundry.
3030
*
3131
* @author Madhura Bhave
32-
* @since 1.5.22
32+
* @since 4.0.0
3333
*/
3434
public class Token {
3535

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
/**
1818
* Auto-configuration for actuator Cloud Foundry concerns.
1919
*/
20-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry;
20+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive;
17+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure.reactive;
1818

1919
import reactor.core.publisher.Mono;
2020

21-
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.EndpointCloudFoundryExtension;
2221
import org.springframework.boot.actuate.endpoint.ApiVersion;
2322
import org.springframework.boot.actuate.endpoint.SecurityContext;
2423
import org.springframework.boot.actuate.endpoint.annotation.EndpointExtension;
@@ -29,13 +28,14 @@
2928
import org.springframework.boot.actuate.health.HealthComponent;
3029
import org.springframework.boot.actuate.health.HealthEndpoint;
3130
import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension;
31+
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.EndpointCloudFoundryExtension;
3232

3333
/**
3434
* Reactive {@link EndpointExtension @EndpointExtension} for the {@link HealthEndpoint}
3535
* that always exposes full health details.
3636
*
3737
* @author Madhura Bhave
38-
* @since 2.0.0
38+
* @since 4.0.0
3939
*/
4040
@EndpointCloudFoundryExtension(endpoint = HealthEndpoint.class)
4141
public class CloudFoundryReactiveHealthEndpointWebExtension {
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive;
17+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure.reactive;
1818

1919
import java.util.Locale;
2020

2121
import org.apache.commons.logging.Log;
2222
import org.apache.commons.logging.LogFactory;
2323
import reactor.core.publisher.Mono;
2424

25-
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryAuthorizationException;
26-
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryAuthorizationException.Reason;
27-
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.SecurityResponse;
28-
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.Token;
25+
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.CloudFoundryAuthorizationException;
26+
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.CloudFoundryAuthorizationException.Reason;
27+
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.SecurityResponse;
28+
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.Token;
2929
import org.springframework.http.HttpStatus;
3030
import org.springframework.http.server.reactive.ServerHttpRequest;
3131
import org.springframework.util.StringUtils;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive;
17+
package org.springframework.boot.cloudfoundry.actuate.autoconfigure.reactive;
1818

1919
import java.util.Collection;
2020
import java.util.Collections;
@@ -30,9 +30,6 @@
3030
import org.springframework.aot.hint.RuntimeHintsRegistrar;
3131
import org.springframework.aot.hint.annotation.Reflective;
3232
import org.springframework.aot.hint.annotation.ReflectiveRuntimeHintsRegistrar;
33-
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.AccessLevel;
34-
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.SecurityResponse;
35-
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive.CloudFoundryWebFluxEndpointHandlerMapping.CloudFoundryWebFluxEndpointHandlerMappingRuntimeHints;
3633
import org.springframework.boot.actuate.endpoint.EndpointId;
3734
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
3835
import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver;
@@ -41,6 +38,9 @@
4138
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
4239
import org.springframework.boot.actuate.endpoint.web.Link;
4340
import org.springframework.boot.actuate.endpoint.web.WebOperation;
41+
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.AccessLevel;
42+
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.SecurityResponse;
43+
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.reactive.CloudFoundryWebFluxEndpointHandlerMapping.CloudFoundryWebFluxEndpointHandlerMappingRuntimeHints;
4444
import org.springframework.boot.webflux.actuate.endpoint.web.AbstractWebFluxEndpointHandlerMapping;
4545
import org.springframework.context.annotation.ImportRuntimeHints;
4646
import org.springframework.http.HttpStatus;

0 commit comments

Comments
 (0)