Skip to content

Conversation

@spencergibb
Copy link
Member

Client specific configuration goes under spring.cloud.loadbalancer.clients.<serviceId>.*. Defaults are set using spring.cloud.loadbalancer.*.

Fixes gh-914

Client specific configuration goes under `spring.cloud.loadbalancer.clients.<serviceId>.*`. Defaults are set using `spring.cloud.loadbalancer.*`.

Fixes gh-914
Adds LoadBalancerDefaultMappingsProviderAutoConfiguration to supply the loadbalancer defaults mapping to DefaultsBindHandlerAdvisor
Copy link
Collaborator

@OlgaMaciaszek OlgaMaciaszek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks very good and solves the default fallback issue. I'm only wandering about if we could also somehow rewrite the places where we use @ConditionalOnProperty (like here) to enable per-client config. wdyt?

Map<ConfigurationPropertyName, ConfigurationPropertyName> mappings = new HashMap<>();
mappings.put(ConfigurationPropertyName.of("spring.cloud.loadbalancer.clients"),
ConfigurationPropertyName.of("spring.cloud.loadbalancer"));
return mappings;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks like that's what we were missing in the previous considerations for this issue.

public class LoadBalancerDefaultMappingsProviderAutoConfiguration {

@Bean
public DefaultsBindHandlerAdvisor.MappingsProvider rabbitExtendedPropertiesDefaultMappingsProvider() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove rabbit from method name?

@spencergibb
Copy link
Member Author

yes, anything in LoadBalancerClientConfiguration's will need a custom @Conditional*.

LoadBalancerClientsProperties now extends LoadBalancerProperties. The `clients` attribute is now a field. The `@ConfigurationProperties("spring.cloud.loadbalancer")` has moved from LoadBalancerProperties to LoadBalancerClientsProperties
@Aloren
Copy link

Aloren commented Nov 4, 2021

Thank you! That was a long-awaited feature ❤️

@spencergibb spencergibb deleted the lb-client-config branch January 3, 2022 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No way to configure loadbalancer properties per client

5 participants