Skip to content

Commit b81a4af

Browse files
committed
fix: skipping recovery manual declaration when no application context
1 parent a0398ac commit b81a4af

File tree

1 file changed

+9
-2
lines changed
  • spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core

1 file changed

+9
-2
lines changed

spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitAdmin.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,8 @@ public void afterPropertiesSet() {
638638
@Override // NOSONAR complexity
639639
public void initialize() {
640640

641+
redeclareManualDeclarables();
642+
641643
if (this.applicationContext == null) {
642644
this.logger.debug("no ApplicationContext has been set, cannot auto-declare Exchanges, Queues, and Bindings");
643645
return;
@@ -690,6 +692,13 @@ public void initialize() {
690692
declareBindings(channel, bindings.toArray(new Binding[bindings.size()]));
691693
return null;
692694
});
695+
this.logger.debug("Declarations finished");
696+
697+
}
698+
/**
699+
* Process manual declarables.
700+
*/
701+
private void redeclareManualDeclarables() {
693702
if (this.manualDeclarables.size() > 0) {
694703
synchronized (this.manualDeclarables) {
695704
this.logger.debug("Redeclaring manually declared Declarables");
@@ -706,8 +715,6 @@ else if (dec instanceof Exchange exch) {
706715
}
707716
}
708717
}
709-
this.logger.debug("Declarations finished");
710-
711718
}
712719

713720
/**

0 commit comments

Comments
 (0)