spring-ai
spring-ai copied to clipboard
fix: Use WebClient.Builder and RestClient.Builder From Spring Dependency Injection Mechanism for OpenAI.
Closes #609
Previously, the code employed WebClient.builder() and RestClient.builder() directly for constructing instances without making use of Spring's dependency injection capabilities. This direct approach posed limitations, particularly in scenarios where users wished to extend or modify the configuration of WebClient. Unfortunately, due to the direct instantiation, such customization was not feasible.
To address this limitation, the fix introduces a more robust solution by embracing Spring's dependency injection mechanism. By leveraging this capability, configuration and management of these builders are now centralized within the Spring application context. This empowers users to easily extend, customize, or override configurations as needed, enhancing the flexibility and maintainability of the codebase.