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

Refactor: Migrate from AsyncRestTemplate to WebClient #7196

Closed
4 tasks
YongGoose opened this issue Mar 9, 2025 · 3 comments
Closed
4 tasks

Refactor: Migrate from AsyncRestTemplate to WebClient #7196

YongGoose opened this issue Mar 9, 2025 · 3 comments

Comments

@YongGoose
Copy link
Contributor

Description

The current implementation uses AsyncRestTemplate, which has been deprecated since Spring 5 and removed in Spring 6 / Spring Boot 3.

public AsyncRestTemplate asyncRestTemplate(RestTemplate restTemplate) {

To ensure long-term compatibility and improved performance, we should migrate to WebClient, which provides a fully non-blocking, reactive approach.

Why Change?

  • AsyncRestTemplate is no longer maintained and will be removed in future Spring versions.
  • WebClient is the recommended replacement, offering better performance, flexibility, and built-in support for reactive programming.
  • Improved error handling, timeout management, and request customization compared to AsyncRestTemplate.

Tasks

  • Identify all instances of AsyncRestTemplate in the codebase.
  • Replace them with WebClient, ensuring equivalent functionality.
  • Test the changes to verify expected behavior.
  • Update documentation if necessary.

References

@YongGoose
Copy link
Contributor Author

@funky-eyes

If you believe this issue should be addressed, please add it as a sub-issue under the below issue and assign me :)

@funky-eyes
Copy link
Contributor

funky-eyes commented Mar 9, 2025

webclient will rely on spring-reactor, and its encoding method is very different from the current synchronous request model. I think it is more appropriate to use asynchronous callback, so I use AsyncRestTemplate

@YongGoose
Copy link
Contributor Author

webclient will rely on spring-reactor, and its encoding method is very different from the current synchronous request model. I think it is more appropriate to use asynchronous callback, so I use AsyncResetTemplate

Thanks for your comment!
I've decided that this refactoring is unnecessary, so I will close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants