Skip to content

Commit c944ee3

Browse files
committed
Add more gap between the orders
Closes gh-38684
1 parent cd1d223 commit c944ee3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -98,7 +98,7 @@ public class CloudFoundryVcapEnvironmentPostProcessor implements EnvironmentPost
9898
private final Log logger;
9999

100100
// Before ConfigDataEnvironmentPostProcessor so values there can use these
101-
private int order = ConfigDataEnvironmentPostProcessor.ORDER - 1;
101+
private int order = ConfigDataEnvironmentPostProcessor.ORDER - 5;
102102

103103
/**
104104
* Create a new {@link CloudFoundryVcapEnvironmentPostProcessor} instance.

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/cloud/cloudfoundry/CloudFoundryVcapEnvironmentPostProcessorTests.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
2121
import org.junit.jupiter.api.Test;
2222

2323
import org.springframework.boot.cloud.CloudFoundryVcapEnvironmentPostProcessor;
24+
import org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor;
2425
import org.springframework.context.ConfigurableApplicationContext;
2526
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
2627
import org.springframework.test.context.support.TestPropertySourceUtils;
@@ -32,6 +33,7 @@
3233
*
3334
* @author Dave Syer
3435
* @author Andy Wilkinson
36+
* @author Moritz Halbritter
3537
*/
3638
class CloudFoundryVcapEnvironmentPostProcessorTests {
3739

@@ -119,6 +121,12 @@ void testServicePropertiesWithoutNA() {
119121
assertThat(getProperty("vcap.services.mysql.credentials.port")).isEqualTo("3306");
120122
}
121123

124+
@Test
125+
void orderShouldBeBeforeConfigDataEnvironmentPostProcessorWithGap() {
126+
assertThat(this.initializer.getOrder()).isLessThan(ConfigDataEnvironmentPostProcessor.ORDER);
127+
assertThat(this.initializer.getOrder()).isLessThan(ConfigDataEnvironmentPostProcessor.ORDER - 1);
128+
}
129+
122130
private String getProperty(String key) {
123131
return this.context.getEnvironment().getProperty(key);
124132
}

0 commit comments

Comments
 (0)