Skip to content

Commit

Permalink
fix: Ensure proper merging of Binder default props (#2177)
Browse files Browse the repository at this point in the history
Fixes #2151.
  • Loading branch information
meltsufin authored Sep 18, 2023
1 parent 4a01e18 commit 01b3dad
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2017-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.spring.stream.binder.pubsub.config;

import java.util.Collections;
import org.springframework.boot.context.properties.source.ConfigurationPropertyName;
import org.springframework.cloud.stream.config.BindingHandlerAdvise.MappingsProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* Configuration for extended binding metadata.
*/
@Configuration(proxyBeanMethods = false)
public class ExtendedBindingHandlerMappingsProviderConfiguration {

@Bean
public MappingsProvider pubSubExtendedPropertiesDefaultMappingsProvider() {
return () -> Collections.singletonMap(
ConfigurationPropertyName.of("spring.cloud.stream.gcp.pubsub.bindings"),
ConfigurationPropertyName.of("spring.cloud.stream.gcp.pubsub.default"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@
import com.google.cloud.spring.stream.binder.pubsub.PubSubMessageChannelBinder;
import com.google.cloud.spring.stream.binder.pubsub.properties.PubSubExtendedBindingProperties;
import com.google.cloud.spring.stream.binder.pubsub.provisioning.PubSubChannelProvisioner;
import java.util.Collections;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.context.properties.source.ConfigurationPropertyName;
import org.springframework.cloud.stream.binder.Binder;
import org.springframework.cloud.stream.config.BindingHandlerAdvise.MappingsProvider;
import org.springframework.cloud.stream.config.ConsumerEndpointCustomizer;
import org.springframework.cloud.stream.config.ProducerMessageHandlerCustomizer;
import org.springframework.context.annotation.Bean;
Expand Down Expand Up @@ -71,12 +68,4 @@ public PubSubMessageChannelBinder pubSubBinder(

return binder;
}

@Bean
public MappingsProvider pubSubExtendedPropertiesDefaultMappingsProvider() {
return () ->
Collections.singletonMap(
ConfigurationPropertyName.of("spring.cloud.stream.gcp.pubsub.bindings"),
ConfigurationPropertyName.of("spring.cloud.stream.gcp.pubsub.default"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.google.cloud.spring.stream.binder.pubsub.config.ExtendedBindingHandlerMappingsProviderConfiguration

0 comments on commit 01b3dad

Please sign in to comment.