Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.25k stars 1.93k forks source link

[FEATURE REQ] Make Azure AD related RestTemplate can be configured by RestTemplate bean #31690

Open chenrujun opened 1 year ago

chenrujun commented 1 year ago

Context

Now Azure AD (and Azure AD B2C) related RestTemplates are created by static method in AadRestTemplateCreator, so customer cannot configure each RestTemplate according to their requirement. For example: set different http header for each RestTemplate.

Goal

Make Azure AD (and Azure AD B2C) related RestTemplate can be configured by RestTemplate bean.

chenrujun commented 1 year ago

After discussion with @saragluna , we will not provide this feature for now, here are the reasons:

  1. Change to RestTemplate bean may have bad effect to customer's code. For example, customer have to specify bean name if their code requires a RestTemplate bean: Before:

    @Bean
    public someBeanMethod(RestTemplate restTemplate) {
        ...
    }

    After:

    public someBeanMethod(@Qualifier("...")RestTemplate restTemplate) {
        ...
    }
  2. The priority is not high. We can provide this feature when there is customer ask for this feature.

I'll change the Milestone to backlog.