Skip to content

Commit 709a34b

Browse files
committed
GH-1214: Fix NPE When no Container id or Bean name
Resolves #1214 Micrometer throws an NPE.
1 parent 519a2c9 commit 709a34b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/AbstractMessageListenerContainer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,11 @@ public final void afterPropertiesSet() {
11441144
try {
11451145
if (this.micrometerHolder == null && MICROMETER_PRESENT && this.micrometerEnabled
11461146
&& this.applicationContext != null) {
1147-
this.micrometerHolder = new MicrometerHolder(this.applicationContext, getListenerId(),
1147+
String id = getListenerId();
1148+
if (id == null) {
1149+
id = "no_id_or_beanName";
1150+
}
1151+
this.micrometerHolder = new MicrometerHolder(this.applicationContext, id,
11481152
this.micrometerTags);
11491153
}
11501154
}

0 commit comments

Comments
 (0)