Skip to content

Add @Order annotation to gatewayRestClientCustomizer bean - #4119

Open
CheHyeonYeong wants to merge 1 commit into
spring-cloud:mainfrom
CheHyeonYeong:feature/issue-3626-order-annotation
Open

CheHyeonYeong wants to merge 1 commit into
spring-cloud:mainfrom
CheHyeonYeong:feature/issue-3626-order-annotation

Conversation

@CheHyeonYeong

@CheHyeonYeong CheHyeonYeong commented Mar 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add @Order(0) annotation to gatewayRestClientCustomizer bean
  • This allows users to define custom RestClientCustomizer beans that run after the gateway customizer and can override the requestFactory

Test plan

  • Added test to verify @Order annotation exists on the bean method
  • Added test to verify custom RestClientCustomizer can coexist with gateway customizer
  • All existing tests pass

Closes #3626

This allows users to add custom RestClientCustomizer beans that can
override the requestFactory by running after the gateway customizer.

Closes spring-cloud#3626

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: CheHyeonYeong <gusdudco6@naver.com>
}

@Test
void customRestClientCustomizerCanOverrideGatewayCustomizer() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I dont see how this test verifies that additional RestClientCustomizer runs after the default one

@Asyncronize

Copy link
Copy Markdown

Hi @CheHyeonYeong, are you still planning to update this one? I'd like to help get #3626 over the line.

I think what @ryanjbaxter is after is a test where the ordering actually changes the outcome. Something like: define a ClientHttpRequestFactory bean so the gateway customizer applies it, add a user RestClientCustomizer without @Order that sets a different request factory, then take the RestClient.Builder from the context and check that the user's factory is the one that wins. Without the @Order(0) that test should fail, since the gateway customizer would run last and overwrite it.

If you don't have time for it, no problem at all. I'm happy to open a follow-up PR that builds on yours and keeps you as co-author.

@CheHyeonYeong

Copy link
Copy Markdown
Contributor Author

@Asyncronize
oh i don't have time to update it plz do it
thx

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add @Order annotation to gatewayRestClientCustomizer Bean

4 participants