This commit is contained in:
Phillip Webb
2018-01-18 21:41:43 -08:00
parent 71ab5dd748
commit 8e783cdae9
8 changed files with 47 additions and 45 deletions

View File

@@ -16,6 +16,8 @@
package org.springframework.boot.autoconfigure.web;
import reactor.core.support.Assert;
import org.springframework.beans.BeansException;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -80,14 +82,11 @@ public class ServerPropertiesAutoConfiguration {
// a single bean
String[] serverPropertiesBeans = this.applicationContext
.getBeanNamesForType(ServerProperties.class);
if (serverPropertiesBeans.length == 0) {
throw new IllegalStateException("No ServerProperties bean registered");
}
if (serverPropertiesBeans.length > 1) {
throw new IllegalStateException(
"Multiple ServerProperties beans registered " + StringUtils
.arrayToCommaDelimitedString(serverPropertiesBeans));
}
Assert.state(serverPropertiesBeans.length != 0,
"No ServerProperties registered");
Assert.state(serverPropertiesBeans.length == 1,
"Multiple ServerProperties registered " + StringUtils
.arrayToCommaDelimitedString(serverPropertiesBeans));
}
}