@ -27,6 +27,7 @@ import org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.Addr
@@ -27,6 +27,7 @@ import org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.Addr
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.CacheMode ;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.ConfirmType ;
import org.springframework.boot.context.properties.ConfigurationProperties ;
import org.springframework.boot.context.properties.source.InvalidConfigurationPropertyValueException ;
import org.springframework.boot.convert.DurationUnit ;
import org.springframework.util.CollectionUtils ;
import org.springframework.util.StringUtils ;
@ -43,6 +44,7 @@ import org.springframework.util.StringUtils;
@@ -43,6 +44,7 @@ import org.springframework.util.StringUtils;
* @author Artsiom Yudovin
* @author Franjo Zilic
* @author Eddú Meléndez
* @author Rafael Carvalho
* @since 1 . 0 . 0
* /
@ConfigurationProperties ( prefix = "spring.rabbitmq" )
@ -203,6 +205,10 @@ public class RabbitProperties {
@@ -203,6 +205,10 @@ public class RabbitProperties {
* /
public String determineAddresses ( ) {
if ( CollectionUtils . isEmpty ( this . parsedAddresses ) ) {
if ( this . host . contains ( "," ) ) {
throw new InvalidConfigurationPropertyValueException ( "spring.rabbitmq.host" , this . host ,
"Invalid character ','. Value must be a single host. For multiple hosts, use property 'spring.rabbitmq.addresses' instead." ) ;
}
return this . host + ":" + determinePort ( ) ;
}
List < String > addressStrings = new ArrayList < > ( ) ;