Skip to content

Conversation

@filiphr
Copy link
Contributor

@filiphr filiphr commented Nov 6, 2025

I know that Spring AI 1.x is only compatible with Spring Boot 3 and Spring 6. However, we are trying to migrate to Spring Boot 4 and keep using Spring AI 1.x. Once Spring AI 2.x is released we are going to migrate to it.

However, in the meantime it is not possible due to few things:

  • Spring Boot 4 - big restructure of it's modules. This is OK, since we could create our own auto configurations for what we need
  • Spring Web HttpHeaders - Use of certain methods from HttpHeaders which are no longer available in Spring 7.

This PR is trying to use alternative methods which are available both in Spring 6 and Spring 7. This means that things like the OpenAiAPI, AnthropicApi etc. can still be used on Spring 7.

I hope that you can consider this PR and consider porting it to Spring AI 1.1.

…nd Spring 7

Signed-off-by: Filip Hrisafov <filip.hrisafov@gmail.com>
@ericbottard
Copy link
Member

Hi @filiphr,

thanks for your PR that could be a good first step indeed.

Forcing the use of spring-web 7 though (by adding

			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-web</artifactId>
				<version>7.0.0-M8</version>
			</dependency>

in the dependencies sections), and after skipping over some other deprecations, I still get a couple of wrong API usages (in hugging-face first, but there could be others).

Could you take a look and try to cover the last extra mile?

@ericbottard ericbottard self-assigned this Nov 6, 2025
@filiphr
Copy link
Contributor Author

filiphr commented Nov 6, 2025

Thanks for reviewing @ericbottard, there were indeed some more spring-web 7 compilation problems. I have that fixed locally. I'll push it. I can also push a GitHub workflow that will run a compile with Spring 7.

@filiphr filiphr force-pushed the spring-7-forward-compatible branch from ad53fe4 to fc89e2a Compare November 6, 2025 18:01
* Add GitHub Worklfow that runs the suite with Spring 7
* Uncomment `@Override` from methods implementing from ResponseHandler
* Add custom ApiClient.mustache, original copied from https://github.com/swagger-api/swagger-codegen/blob/92fcc8196bd90fef199c2932903135e3b519f689/modules/swagger-codegen/src/main/resources/Java/ApiClient.mustache and adjusted the use of the HttpHeaders to be compliant with Spring 7
* Adjust ChatCLientExtensions.kt to be compatible with Kotlin 2

Signed-off-by: Filip Hrisafov <filip.hrisafov@gmail.com>
@filiphr filiphr force-pushed the spring-7-forward-compatible branch from fc89e2a to 6abae08 Compare November 6, 2025 18:03
@filiphr
Copy link
Contributor Author

filiphr commented Nov 6, 2025

@ericbottard I've done the additional adjustments so that the entire code base can compile with Spring 7. I also added a GitHub workflow build so that a PR check is run with the compilation.

The "biggest" change is the ApiClient.mustache. I put it in quotes, since that file is the most amount of lines, but if you actually compare it with the one from the Swagger Codegen you'll see that the change is one or 2 lines around the header checks.

Let me know what you think

Signed-off-by: Filip Hrisafov <filip.hrisafov@gmail.com>
@filiphr filiphr force-pushed the spring-7-forward-compatible branch from 3f0f462 to 8dca2fa Compare November 6, 2025 18:06
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

Successfully merging this pull request may close these issues.

2 participants