Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restTemplateBuilderConfigurer doesn't need to be @ConditionalOnMissingBean #36264

Closed
wilkinsona opened this issue Jul 6, 2023 · 1 comment
Closed
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement

Comments

@wilkinsona
Copy link
Member

restTemplateBuilderConfigurer defined by RestTemplateAutoConfiguration is @ConditonalOnMissingBean but that condition doesn't appear to be necessary. RestTemplateBuilderConfigurer is a final class and is immutable from the perspective of its public API. You could define a custom configurer bean but it would be in its default state and would do nothing when asked to configure the RestTemplateBuilder. You could just define a RestTemplateBuilder bean directly instead:

@Bean
public RestTemplateBuilder restTemplateBuilder() {
	 return new RestTemplateBuilder();
}

We should remove @ConditonalOnMissingBean. In the unlikely event of someone having defined their own RestTemplateBuilderConfigurer this would be a breaking change as two RestTemplateBuilderConfigurer beans would then be defined. As such, we should remove the condition in 3.2 at the earliest and mention the change in the release notes.

@wilkinsona wilkinsona added this to the 3.x milestone Jul 6, 2023
@wilkinsona wilkinsona added the type: enhancement A general enhancement label Jul 6, 2023
@wilkinsona wilkinsona changed the title restTemplateBuilderConfigurer doesn't need to be @ConditionalOnMissingBean restTemplateBuilderConfigurer doesn't need to be @ConditionalOnMissingBean Jul 6, 2023
@wilkinsona
Copy link
Member Author

Closing in favor of #37746.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2023
@wilkinsona wilkinsona removed this from the 3.x milestone Oct 10, 2023
@wilkinsona wilkinsona added the status: superseded An issue that has been superseded by another label Oct 10, 2023
@philwebb philwebb changed the title restTemplateBuilderConfigurer doesn't need to be @ConditionalOnMissingBean restTemplateBuilderConfigurer doesn't need to be @ConditionalOnMissingBean Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant