Skip to content

Conversation

@cpage-pivotal
Copy link

Summary

  • Adds Spring Boot 3.x autoconfiguration support to the spring-ai-claude-agent module
  • Fixes compatibility issue with Spring Boot 3.5.0 applications

Problem

When running samples with Spring Boot 3.5.0 (e.g., getting-started-hello-world), the application failed to start with:

Error creating bean with name 'demo': Unsatisfied dependency expressed through method 'demo' parameter 0: 
No qualifying bean of type 'org.springaicommunity.agents.client.AgentClient$Builder' available

Root Cause

Spring Boot changed its autoconfiguration discovery mechanism in version 3.x:

  • Spring Boot 2.x: Uses META-INF/spring.factories
  • Spring Boot 3.x: Uses META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

The spring-ai-claude-agent module only had the Spring Boot 2.x format, causing Spring Boot 3.x to not discover ClaudeAgentAutoConfiguration and SandboxAutoConfiguration. Without these, the required beans were never created.

Solution

Added META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports with the two autoconfiguration classes:

  • org.springaicommunity.agents.claude.autoconfigure.ClaudeAgentAutoConfiguration
  • org.springaicommunity.agents.claude.autoconfigure.SandboxAutoConfiguration

The existing spring.factories file is retained for backward compatibility with Spring Boot 2.x applications.

Test Plan

  • Verify the autoconfiguration file is included in the built jar
  • Test that getting-started-hello-world sample starts successfully with Spring Boot 3.5.0
  • Verify AgentClient.Builder bean is properly injected
  • Confirm backward compatibility with Spring Boot 2.x (if applicable)

Impact

  • Enables Spring Boot 3.x compatibility for the Claude agent module
  • No breaking changes - maintains Spring Boot 2.x compatibility
  • Other agent model modules (Gemini, SWE-bench) may need similar updates

Add AutoConfiguration.imports file to support Spring Boot 3.x's new
autoconfiguration discovery mechanism. This ensures ClaudeAgentAutoConfiguration
and SandboxAutoConfiguration are properly discovered in Spring Boot 3.x
applications.

The existing spring.factories file is retained for Spring Boot 2.x compatibility.

Fixes the "No qualifying bean of type 'AgentClient$Builder' available" error
when running samples with Spring Boot 3.5.0.
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.

1 participant