Scenario-based pick guide for Spring AI 2.1.0 vs LangChain4j 1.24.1 on the JVM — Boot autoconfig and advisors vs library-first AiServices, graphs, and ChatModel seams.
Use Spring AI When
Greenfield Spring Boot 4.x service
Use Langchain4j When
Plain Java, Quarkus, or mixed stack
Both Ship The Same Basics
Tools, RAG, structured output, many providers
Code · Spring AI 2.1
// one hop: reserve → call → settle public ChatClientResponse adviseCall( ChatClientRequest req, CallAdvisorChain chain) { var hold = gateway.reserve(scope(req), estimate(req)); try { return settle(hold, chain.nextCall(req)); } catch ( RuntimeException ex) { gateway.release(hold); throw ex; } } Inside ToolCallingAdvisor loop, not outside memory.