Skip to content

Commit

Permalink
Spring cloud azure refactor global properties (#25239)
Browse files Browse the repository at this point in the history
  • Loading branch information
saragluna authored Nov 15, 2021
1 parent 64bcb2b commit 1a124b0
Show file tree
Hide file tree
Showing 88 changed files with 1,477 additions and 666 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ the main ServiceBusClientBuilder. -->

<!-- MissingJavadocMethod: Temporarily skip -->
<suppress checks="MissingJavadocMethod" files=".*[/\\]com[/\\]azure[/\\]spring[/\\].*"/>
<!-- JavadocThrowsChecks: Temporarily skip -->
<suppress checks="JavadocThrowsChecks" files=".*[/\\]com[/\\]azure[/\\]spring[/\\].*"/>
<!-- MissingJavadocMethod: internal packages -->
<suppress checks="MissingJavadocType|JavadocThrowsChecks|EnforceFinalFields" files=".*[/\\]com[/\\]azure[/\\]spring[/\\]integration[/\\]test.*"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2311,7 +2311,7 @@
</Match>

<Match>
<Class name="com.azure.spring.cloud.autoconfigure.jms.AzureServiceBusJmsProperties"/>
<Class name="com.azure.spring.cloud.autoconfigure.jms.properties.AzureServiceBusJmsProperties"/>
<Field name="pricingTier"/>
<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
</Match>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.azure.cosmos.CosmosAsyncClient;
import com.azure.spring.cloud.actuate.cosmos.CosmosHealthIndicator;
import com.azure.spring.cloud.autoconfigure.cosmos.AzureCosmosAutoConfiguration;
import com.azure.spring.cloud.autoconfigure.cosmos.AzureCosmosProperties;
import com.azure.spring.cloud.autoconfigure.cosmos.properties.AzureCosmosProperties;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
package com.azure.spring.cloud.autoconfigure;

import com.azure.spring.cloud.autoconfigure.properties.AzureGlobalProperties;
import com.azure.spring.core.aware.ClientAware;
import com.azure.spring.core.aware.ProxyAware;
import com.azure.spring.core.aware.RetryAware;
import com.azure.spring.core.properties.AzureProperties;
import com.azure.spring.core.properties.AzurePropertiesUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

Expand All @@ -24,6 +28,28 @@ public AzureServiceConfigurationBase(AzureGlobalProperties azureProperties) {

protected <T extends AzureProperties> T loadProperties(AzureGlobalProperties source, T target) {
AzurePropertiesUtils.copyAzureCommonProperties(source, target);

if (target.getClient() instanceof ClientAware.HttpClient) {
BeanUtils.copyProperties(source.getClient().getHttp(), target.getClient());

ClientAware.HttpClient targetClient = (ClientAware.HttpClient) target.getClient();
BeanUtils.copyProperties(source.getClient().getHttp().getLogging(), targetClient.getLogging());
targetClient.getLogging().getAllowedHeaderNames().addAll(source.getClient().getHttp().getLogging().getAllowedHeaderNames());
targetClient.getLogging().getAllowedQueryParamNames().addAll(source.getClient().getHttp().getLogging().getAllowedQueryParamNames());
}

if (target.getClient() instanceof ClientAware.AmqpClient) {
BeanUtils.copyProperties(source.getClient().getAmqp(), target.getClient());
}

if (target.getProxy() instanceof ProxyAware.HttpProxy) {
BeanUtils.copyProperties(source.getProxy().getHttp(), target.getProxy());
}

if (target.getRetry() instanceof RetryAware.HttpRetry) {
BeanUtils.copyProperties(source.getRetry().getHttp(), target.getRetry());
}

return target;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.azure.data.appconfiguration.ConfigurationClient;
import com.azure.data.appconfiguration.ConfigurationClientBuilder;
import com.azure.spring.cloud.autoconfigure.AzureServiceConfigurationBase;
import com.azure.spring.cloud.autoconfigure.appconfiguration.properties.AzureAppConfigurationProperties;
import com.azure.spring.cloud.autoconfigure.condition.ConditionalOnAnyProperty;
import com.azure.spring.cloud.autoconfigure.properties.AzureGlobalProperties;
import com.azure.spring.core.AzureSpringIdentifier;
Expand Down
Loading

0 comments on commit 1a124b0

Please sign in to comment.