embabel-agent icon indicating copy to clipboard operation
embabel-agent copied to clipboard

Spring Boot 4 support

Open MojoManagement opened this issue 2 months ago • 4 comments

Spring Boot 4 will be released soon, RC versions are already available. Are there plans when to support Spring Boot 4?

MojoManagement avatar Nov 18 '25 07:11 MojoManagement

Currently Embabel works with the latest GA, 3.5.7. Unsure of breakages 4.0 may bring--possibly due to the greater modularity. We will consider after 4.0 goes GA.

johnsonr avatar Nov 18 '25 09:11 johnsonr

Spring Boot 4.0 is now GA.

CustomErrorController implements the org.springframework.boot.web.servlet.error.ErrorController tag interface, which has moved. This needs to be fixed as a minimum. I believe there are alternatives to using this interface that will work pre 4.0 also.

johnsonr avatar Nov 20 '25 23:11 johnsonr

I migrated the error handling in a way that is also best practice for Spring Boot 3.x.

However it now appears that Spring AI is incompatible with Spring 7:


[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< com.embabel.agent:launchpad >---------------------
[INFO] Building Embabel launchpad 0.1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] >>> spring-boot:4.0.0:run (default-cli) > test-compile @ launchpad >>>
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ launchpad ---
[INFO] Copying 4 resources from src/main/resources to target/classes
[INFO] Copying 15 resources from src/main/resources to target/classes
[INFO] 
[INFO] --- compiler:3.14.1:compile (default-compile) @ launchpad ---
[INFO] Recompiling the module because of added or removed source files.
[INFO] Compiling 17 source files with javac [debug parameters release 21] to target/classes
[INFO] /Users/rjohnson/dev/embabel.com/launchpad/src/main/java/com/embabel/agent/rag/keyword/KeywordRetrievableEnhancer.java: Some input files use or override a deprecated API.
[INFO] /Users/rjohnson/dev/embabel.com/launchpad/src/main/java/com/embabel/agent/rag/keyword/KeywordRetrievableEnhancer.java: Recompile with -Xlint:deprecation for details.
[INFO] /Users/rjohnson/dev/embabel.com/launchpad/src/main/java/com/embabel/agent/rag/keyword/KeywordRetrievableEnhancer.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/rjohnson/dev/embabel.com/launchpad/src/main/java/com/embabel/agent/rag/keyword/KeywordRetrievableEnhancer.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- resources:3.3.1:testResources (default-testResources) @ launchpad ---
[INFO] Copying 1 resource from src/test/resources to target/test-classes
[INFO] 
[INFO] --- compiler:3.14.1:testCompile (default-testCompile) @ launchpad ---
[INFO] Recompiling the module because of changed dependency.
[INFO] 
[INFO] <<< spring-boot:4.0.0:run (default-cli) < test-compile @ launchpad <<<
[INFO] 
[INFO] 
[INFO] --- spring-boot:4.0.0:run (default-cli) @ launchpad ---
Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-buildpack-platform/4.0.0/spring-boot-buildpack-platform-4.0.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-buildpack-platform/4.0.0/spring-boot-buildpack-platform-4.0.0.jar (330 kB at 131 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-loader-tools/4.0.0/spring-boot-loader-tools-4.0.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-loader-tools/4.0.0/spring-boot-loader-tools-4.0.0.jar (339 kB at 4.1 MB/s)
[INFO] Attaching agents: []
   ___  ___    _______ .___  ___. .______        ___      .______    _______  __         ___  ___
  /  / /  /   |   ____||   \/   | |   _  \      /   \     |   _  \  |   ____||  |        \  \ \  \
 /  / /  /    |  |__   |  \  /  | |  |_)  |    /  ^  \    |  |_)  | |  |__   |  |         \  \ \  \
<  < <  <     |   __|  |  |\/|  | |   _  <    /  /_\  \   |   _  <  |   __|  |  |          >  > >  >
 \  \ \  \    |  |____ |  |  |  | |  |_)  |  /  _____  \  |  |_)  | |  |____ |  `----.    /  / /  /
  \__\ \__\   |_______||__|  |__| |______/  /__/     \__\ |______/  |_______||_______|   /__/ /__/

Powered by Spring Boot 4.0.0
2025-11-21 14:38:32.118 [main] INFO  com.embabel.LaunchpadApplication - Starting LaunchpadApplication using Java 21.0.7 with PID 33097 (/Users/rjohnson/dev/embabel.com/launchpad/target/classes started by rjohnson in /Users/rjohnson/dev/embabel.com/launchpad)
2025-11-21 14:38:32.119 [main] INFO  com.embabel.LaunchpadApplication - The following 1 profile is active: "colossus"
2025-11-21 14:38:33.230 [main] WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration' of type [org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected/applied to a currently created BeanPostProcessor [serverAnnotatedMethodBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE.
2025-11-21 14:38:33.231 [main] WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'serverAnnotatedBeanRegistry' of type [org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration$ServerMcpAnnotatedBeans] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected/applied to a currently created BeanPostProcessor [serverAnnotatedMethodBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE.
2025-11-21 14:38:33.234 [main] WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'spring.ai.mcp.server.annotation-scanner-org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerProperties' of type [org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected/applied to a currently created BeanPostProcessor [serverAnnotatedMethodBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE.
2025-11-21 14:38:33.491 [main] INFO  c.e.a.c.m.a.AnthropicModelsConfig - Anthropic models are available: com.embabel.agent.config.models.anthropic.AnthropicProperties@59aba3c3
2025-11-21 14:38:33.492 [main] INFO  c.e.a.c.m.a.AnthropicModelLoader - Loading Anthropic models from classpath:models/anthropic-models.yml
2025-11-21 14:38:33.548 [main] INFO  c.e.a.c.m.a.AnthropicModelLoader - Loaded 7 Anthropic model definitions
2025-11-21 14:38:33.695 [main] INFO  c.e.a.c.m.a.AnthropicModelsConfig - Registered Anthropic model bean: claude_sonnet_45 -> claude-sonnet-4-5
2025-11-21 14:38:33.697 [main] INFO  c.e.a.c.m.a.AnthropicModelsConfig - Registered Anthropic model bean: claude_haiku_45 -> claude-haiku-4-5
2025-11-21 14:38:33.697 [main] INFO  c.e.a.c.m.a.AnthropicModelsConfig - Registered Anthropic model bean: claude_opus_41 -> claude-opus-4-1
2025-11-21 14:38:33.698 [main] INFO  c.e.a.c.m.a.AnthropicModelsConfig - Registered Anthropic model bean: claude_sonnet_4 -> claude-sonnet-4-0
2025-11-21 14:38:33.699 [main] INFO  c.e.a.c.m.a.AnthropicModelsConfig - Registered Anthropic model bean: claude_opus_40 -> claude-opus-4-0
2025-11-21 14:38:33.700 [main] INFO  c.e.a.c.m.a.AnthropicModelsConfig - Registered Anthropic model bean: claude_sonnet_37 -> claude-3-7-sonnet-latest
2025-11-21 14:38:33.701 [main] INFO  c.e.a.c.m.a.AnthropicModelsConfig - Registered Anthropic model bean: claude_haiku_35 -> claude-3-5-haiku-latest
2025-11-21 14:38:33.735 [main] INFO  c.e.a.c.m.openai.OpenAiModelsConfig - Open AI compatible models are available at default OpenAI location. API key is set
2025-11-21 14:38:33.738 [main] WARN  o.s.b.w.s.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'launchpadChatAgent' defined in file [/Users/rjohnson/dev/embabel.com/launchpad/target/classes/com/embabel/launchpad/agent/LaunchpadChatAgent.class]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'dataManager' defined in file [/Users/rjohnson/dev/embabel.com/launchpad/target/classes/com/embabel/launchpad/data/DataManager.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'luceneRagFacetProvider' defined in class path resource [com/embabel/launchpad/config/RagConfiguration.class]: Unsatisfied dependency expressed through method 'luceneRagFacetProvider' parameter 0: Error creating bean with name 'modelProvider' defined in class path resource [com/embabel/agent/spi/config/spring/AgentPlatformConfiguration.class]: Failed to instantiate [com.embabel.common.ai.model.ModelProvider]: Factory method 'modelProvider' threw exception with message: Error creating bean with name 'openAiModelsConfig' defined in URL [jar:file:/Users/rjohnson/.m2/repository/com/embabel/agent/embabel-agent-openai-autoconfigure/0.3.0-SNAPSHOT/embabel-agent-openai-autoconfigure-0.3.0-SNAPSHOT.jar!/com/embabel/agent/config/models/openai/OpenAiModelsConfig.class]: Failed to instantiate [com.embabel.agent.config.models.openai.OpenAiModelsConfig]: Constructor threw exception
2025-11-21 14:38:33.755 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter - 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.ai.openai.api.OpenAiApi.lambda$new$0(OpenAiApi.java:150)

The following method did not exist:

    'void org.springframework.http.HttpHeaders.addAll(org.springframework.util.MultiValueMap)'

The calling method's class, org.springframework.ai.openai.api.OpenAiApi, was loaded from the following location:

    jar:file:/Users/rjohnson/.m2/repository/org/springframework/ai/spring-ai-openai/1.1.0/spring-ai-openai-1.1.0.jar!/org/springframework/ai/openai/api/OpenAiApi.class

The called method's class, org.springframework.http.HttpHeaders, is available from the following locations:

    jar:file:/Users/rjohnson/.m2/repository/org/springframework/spring-web/7.0.1/spring-web-7.0.1.jar!/org/springframework/http/HttpHeaders.class

The called method's class hierarchy was loaded from the following locations:

    org.springframework.http.HttpHeaders: file:/Users/rjohnson/.m2/repository/org/springframework/spring-web/7.0.1/spring-web-7.0.1.jar


johnsonr avatar Nov 21 '25 03:11 johnsonr

Spring AI 1.1 is incompatible with Spring Boot 4. This may not be fixed until Spring AI 2.0.

So for now this is not feasible.

johnsonr avatar Nov 21 '25 05:11 johnsonr