Open habuma opened 3 months ago
can i help
@habuma implementation suggestions?
In case someone is looking for a temporary work around, adding org.springframework.boot:spring-boot-starter-web to the dependencies will resolve the issue.
It is not acceptable to add starters to utility/library. It is ok to add it to the end application, which is the current behaviour. The goal is to have some defaults (non starter) in the library.
Should not spring-ai use HTTP Interface Client, and detect (and use) either WebClient or RestClient builders?
If you have configured "web-application-type", you can try to remove it and restart from
server:
port: 8091
spring:
application:
name: Spring-ai-demo
main:
web-application-type: reactive
to
server:
port: 8091
spring:
application:
name: Spring-ai-demo
When Spring AI auto-configures various client implementations, it depends upon a
RestClient.Builder
to create aRestClient
for those client implementations. That works fine when the project uses the Spring MVC starter because aRestClient.Builder
will be auto-configured. But when using the Spring WebFlux starter, no suchRestClient.Builder
is auto-configured and the application will fail to start.AFAIK, this happens in all recent versions of Spring AI, including 0.8.1 and 1.0.0-SNAPSHOT.
To reproduce, create a simple Spring AI application with a dependency on the WebFlux starter and almost any model starter...such as the OpenAI starter. You do not need to write any code to reproduce this problem. Just create a new Spring Boot project with the aforementioned starters and then try to run it. The application will fail to start and you'll get the following error:
If Spring AI were to ensure the existence of a
RestClient.Builder
then the application would start and function fine, even when using WebFlux.