Add more nullability annotations to module/spring-boot-amqp

See gh-46587
This commit is contained in:
Moritz Halbritter 2025-07-31 10:48:33 +02:00
parent 81c0bfb048
commit 3afbe84bbd
2 changed files with 8 additions and 4 deletions

View File

@ -26,15 +26,15 @@ class MyReactiveHealthIndicator : ReactiveHealthIndicator {
override fun health(): Mono<Health> {
// @formatter:off
return doHealthCheck()!!.onErrorResume { exception: Throwable? ->
return doHealthCheck().onErrorResume { exception: Throwable ->
Mono.just(Health.Builder().down(exception).build())
}
// @formatter:on
}
private fun doHealthCheck(): Mono<Health>? {
private fun doHealthCheck(): Mono<Health> {
// perform some specific health check
return /**/ null
return /**/ Mono.empty()
}
}

View File

@ -43,7 +43,11 @@ public class RabbitHealthIndicator extends AbstractHealthIndicator {
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
builder.up().withDetail("version", getVersion());
builder.up();
String version = getVersion();
if (version != null) {
builder.withDetail("version", version);
}
}
private @Nullable String getVersion() {