Polish RabbitTemplateConfigurer allowed-list-patterns

Closes gh-41349
This commit is contained in:
Johnny Lim 2024-07-04 23:21:23 +09:00 committed by Scott Frederick
parent 5b9c0006e9
commit 3aee73004a
1 changed files with 6 additions and 6 deletions

View File

@ -108,17 +108,17 @@ public class RabbitTemplateConfigurer {
map.from(templateProperties::isObservationEnabled).to(template::setObservationEnabled);
map.from(templateProperties::getAllowedListPatterns)
.whenNot(CollectionUtils::isEmpty)
.to((allowListPatterns) -> setAllowedListPatterns(template.getMessageConverter(), allowListPatterns));
.to((allowedListPatterns) -> setAllowedListPatterns(template.getMessageConverter(), allowedListPatterns));
}
private void setAllowedListPatterns(MessageConverter messageConverter, List<String> allowListPatterns) {
private void setAllowedListPatterns(MessageConverter messageConverter, List<String> allowedListPatterns) {
if (messageConverter instanceof AllowedListDeserializingMessageConverter allowedListDeserializingMessageConverter) {
allowedListDeserializingMessageConverter.setAllowedListPatterns(allowListPatterns);
allowedListDeserializingMessageConverter.setAllowedListPatterns(allowedListPatterns);
return;
}
throw new InvalidConfigurationPropertyValueException("spring.rabbitmq.template.allow-list-patterns",
allowListPatterns,
"Allow list patterns can only be applied to a AllowedListDeserializingMessageConverter");
throw new InvalidConfigurationPropertyValueException("spring.rabbitmq.template.allowed-list-patterns",
allowedListPatterns,
"Allowed list patterns can only be applied to an AllowedListDeserializingMessageConverter");
}
private boolean determineMandatoryFlag() {