-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix issues in kv envpostprocessor (#26794)
- Loading branch information
Showing
5 changed files
with
76 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...ava/com/azure/spring/cloud/autoconfigure/properties/utils/AzureGlobalPropertiesUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.spring.cloud.autoconfigure.properties.utils; | ||
|
||
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.util.AzurePropertiesUtils; | ||
import org.springframework.beans.BeanUtils; | ||
|
||
/** | ||
* Util class for processor {@link AzureGlobalProperties}. | ||
*/ | ||
public final class AzureGlobalPropertiesUtils { | ||
|
||
private AzureGlobalPropertiesUtils() { | ||
|
||
} | ||
|
||
/** | ||
* Load the default value to an Azure Service properties from the global Azure properties. | ||
* | ||
* @param source The global Azure properties. | ||
* @param target The properties of an Azure Service, such as Event Hubs properties. Some common components of the | ||
* service's properties have default value as set to the global properties. For example, the proxy of | ||
* the Event Hubs properties takes the proxy set to the global Azure properties as default. | ||
* @param <T> The type of the properties of an Azure Service. | ||
* @return The Azure Service's properties. | ||
*/ | ||
public static <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; | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
...ure/src/main/java/com/azure/spring/cloud/autoconfigure/properties/utils/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
/** | ||
* Configuration properties util classes. | ||
*/ | ||
package com.azure.spring.cloud.autoconfigure.properties.utils; |