diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/RabbitAccessor.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/RabbitAccessor.java index 88d7d9b65b..6c91c630f7 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/RabbitAccessor.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/RabbitAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 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. @@ -33,6 +33,7 @@ * @author Mark Fisher * @author Dave Syer * @author Gary Russell + * @author Artem Bilan */ public abstract class RabbitAccessor implements InitializingBean { @@ -122,7 +123,7 @@ protected void obtainObservationRegistry(@Nullable ApplicationContext appContext if (appContext != null) { ObjectProvider registry = appContext.getBeanProvider(ObservationRegistry.class); - this.observationRegistry = registry.getIfUnique(); + this.observationRegistry = registry.getIfUnique(() -> this.observationRegistry); } }