Skip to content

Commit f5934f8

Browse files
committed
Merge pull request #42503 from izeye
* pr/42503: Polish Closes gh-42503
2 parents f29d492 + 1585c5a commit f5934f8

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/OpenTelemetryEventPublisherBeansApplicationListener.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public void onApplicationEvent(ApplicationEvent event) {
9999

100100
/**
101101
* {@link ContextStorage#addWrapper(java.util.function.Function) Add} the
102-
* {@link ContextStorage} wrapper to ensure that {@link EventPublisher} are propagated
103-
* correctly.
102+
* {@link ContextStorage} wrapper to ensure that {@link EventPublisher
103+
* EventPublishers} are propagated correctly.
104104
*/
105105
public static void addWrapper() {
106106
if (isInstallable() && added.compareAndSet(false, true)) {
@@ -118,7 +118,7 @@ private static boolean isInstallable() {
118118
*/
119119
static final class Wrapper {
120120

121-
static Wrapper instance = new Wrapper();
121+
static final Wrapper instance = new Wrapper();
122122

123123
private final MultiValueMap<ApplicationContext, EventPublishingContextWrapper> beans = new LinkedMultiValueMap<>();
124124

@@ -149,13 +149,16 @@ ContextStorage getStorageDelegate(ContextStorage parent) {
149149
ContextStorage delegate = this.storageDelegate;
150150
if (delegate == null) {
151151
synchronized (this) {
152-
delegate = parent;
153-
for (List<EventPublishingContextWrapper> publishers : this.beans.values()) {
154-
for (EventPublishingContextWrapper publisher : publishers) {
155-
delegate = publisher.apply(delegate);
152+
delegate = this.storageDelegate;
153+
if (delegate == null) {
154+
delegate = parent;
155+
for (List<EventPublishingContextWrapper> publishers : this.beans.values()) {
156+
for (EventPublishingContextWrapper publisher : publishers) {
157+
delegate = publisher.apply(delegate);
158+
}
156159
}
160+
this.storageDelegate = delegate;
157161
}
158-
this.storageDelegate = delegate;
159162
}
160163
}
161164
return delegate;

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/BaggagePropagationIntegrationTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class BaggagePropagationIntegrationTests {
5757
@BeforeEach
5858
@AfterEach
5959
void setup() {
60-
OpenTelemetryEventPublisherBeansApplicationListener.addWrapper();
6160
MDC.clear();
6261
}
6362

spring-boot-project/spring-boot-test-autoconfigure/src/dockerTest/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestDockerTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ class DataLdapTestDockerTests {
5858
void connectionCanBeMadeToLdapContainer() {
5959
List<String> cn = this.ldapTemplate.search(LdapQueryBuilder.query().where("objectclass").is("dcObject"),
6060
(AttributesMapper<String>) (attributes) -> attributes.get("dc").get().toString());
61-
assertThat(cn).hasSize(1);
62-
assertThat(cn.get(0)).isEqualTo("example");
61+
assertThat(cn).singleElement().isEqualTo("example");
6362
}
6463

6564
@Test

spring-boot-project/spring-boot-testcontainers/src/dockerTest/java/org/springframework/boot/testcontainers/service/connection/ldap/OpenLdapContainerConnectionDetailsFactoryIntegrationTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ class OpenLdapContainerConnectionDetailsFactoryIntegrationTests {
5656
void connectionCanBeMadeToLdapContainer() {
5757
List<String> cn = this.ldapTemplate.search(LdapQueryBuilder.query().where("objectclass").is("dcObject"),
5858
(AttributesMapper<String>) (attributes) -> attributes.get("dc").get().toString());
59-
assertThat(cn).hasSize(1);
60-
assertThat(cn.get(0)).isEqualTo("example");
59+
assertThat(cn).singleElement().isEqualTo("example");
6160
}
6261

6362
@Configuration(proxyBeanMethods = false)

spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ContainerConnectionDetailsFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public final D getConnectionDetails(ContainerConnectionSource<C> source) {
117117
}
118118

119119
/**
120-
* Return if the give source accepts the connection. By default this method checks
120+
* Return if the given source accepts the connection. By default this method checks
121121
* each connection name.
122122
* @param source the container connection source
123123
* @param requiredContainerType the required container type

spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ContainerConnectionSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private static String getOrDeduceConnectionName(String connectionName, String co
9595
}
9696

9797
/**
98-
* Return is this source accepts the given connection.
98+
* Return if this source accepts the given connection.
9999
* @param requiredConnectionName the required connection name or {@code null}
100100
* @param requiredContainerType the required container type
101101
* @param requiredConnectionDetailsType the required connection details type

0 commit comments

Comments
 (0)