Scrivio Interview library
LeadershipPrincipal8 min read · updated 12 November 2026

Generative AI frameworks for Java (Spring AI, LangChain4j, provider SDKs) change quickly, and the next Spring AI major is tied to Spring Boot 4. As the senior technical leader, how do you manage framework choice and upgrade risk for AI features across the company?

We cannot stop AI frameworks from changing, so we make change cheap: pin versions, keep every framework type behind our own small interfaces, and pick one primary framework per platform (Spring AI for Spring Boot services) while allowing provider SDKs where the framework falls short. Then we schedule AI framework upgrades together with Spring Boot majors, keep a central compatibility matrix, judge every upgrade with evaluation suites and observability, and review the choice once a year.

Why this question is asked

Spring AI reached 1.0 in 2025, LangChain4j releases often, and provider SDKs add features every month. A company with thirty services calling models through three different libraries, each on its own version, will spend more time upgrading than building. Interviewers ask this at the senior level because the answer is not about which library is best today; it is about how a leader sets up the organisation so that the next change, which will certainly come, costs days instead of quarters. In this answer, we will look at why the risk is real, how to contain framework code behind internal interfaces, how to choose a primary framework without banning everything else, how to tie upgrades to the Spring Boot roadmap, how to judge an upgrade by behaviour, and how to revisit the decision.

1A Quick Recap: Why AI Frameworks Are a Special Upgrade Risk

Most of the libraries in a Spring Boot service are mature. Jackson, Hibernate and the Spring Framework itself change their public APIs slowly and announce breaking changes years ahead. AI frameworks are young. Spring AI renamed starters and moved packages on its way to 1.0, and its next major version is planned around Spring Boot 4 and Spring Framework 7, which themselves move the baseline to newer Jakarta EE versions. LangChain4j is on a fast release train too. Provider SDKs change whenever the provider adds a new model feature.

There is a second kind of change that ordinary libraries do not have: the same code can behave differently after an upgrade even when it compiles. A new version may change the default prompt that turns a Java record into JSON instructions, the default temperature, or how retries work. So the risk is not only broken builds; it is quiet changes in what users see. A good strategy has to handle both.

2Contain the Framework Behind Internal Interfaces

The first rule is that domain code should never import framework types. A billing service that wants a ticket summary should depend on an interface we own, written in our own vocabulary, and one adapter class should be the only place that knows about Spring AI. When the framework changes, we change one class per feature, not fifty call sites. We also pin exact versions through the Spring AI BOM (bill of materials, a Maven or Gradle file that fixes compatible versions of a group of artifacts) instead of letting builds float.

Java
// Owned by us, used everywhere in the domain
public interface TicketSummarizer {
Summary summarize(Ticket ticket);
}
public record Summary(String text, List<String> actions) {}
// The only class that imports Spring AI
@Component
class SpringAiTicketSummarizer implements TicketSummarizer {
private final ChatClient chat;
SpringAiTicketSummarizer(ChatClient.Builder builder) { this.chat = builder.build(); }
@Override
public Summary summarize(Ticket t) {
return chat.prompt()
.system("Summarise the support ticket in three sentences and list follow-up actions.")
.user(t.body())
.call()
.entity(Summary.class); // Summary parsed from the model's JSON
}
}
Step throughWhere framework code is allowed
  1. Domain servicesuse TicketSummarizer and our own records only
  2. Internal AI interfacessmall, feature-shaped, owned by the team
  3. Adaptersthe only code that imports Spring AI, LangChain4j or an SDK
  4. Shared platform starterpinned BOM, gateway URL, retries, tracing
  5. Model providershosted APIs or self-hosted models

5 layers, from the top down. Step through them one at a time.

Each layer only knows the one below it, so a framework change stops at the adapters.

Notice that ChatClient, the Spring AI entry point for chat calls, appears in one file. If a team later moves this feature to a provider SDK or to LangChain4j, they write a second implementation of TicketSummarizer, run the same evaluation suite against both, and switch with a configuration property. The domain code never notices.

3Choosing a Primary Framework Without Banning the Rest

If every team picks its own library, we pay for that choice many times: each team learns its own failure modes, writes its own retry and tracing code, and needs its own upgrade plan. So we choose one primary framework per platform. For a company whose services run on Spring Boot, Spring AI is the natural default, because it uses the same configuration properties, auto-configuration, Micrometer observations and testing support the teams already know. The platform team then builds a shared starter on top of it with the company's gateway address, timeouts, logging and redaction already set.

A primary framework is a default, not a law. Frameworks always trail the providers by a few weeks or months, so when a team needs a feature the framework does not expose yet, such as a new batch API or a provider-specific tool type, they may call the provider SDK directly inside their adapter. The rule is that the exception stays inside the adapter, is written down, and is reviewed when the framework catches up.

4Aligning Upgrades With the Spring Boot Roadmap

Because the next Spring AI major is tied to Spring Boot 4, we should not plan the two upgrades separately. A Spring Boot major already forces each service through a migration: new Spring Framework baseline, Jakarta EE changes, dependency updates and a full regression run. Doing the AI framework major in the same wave means one test cycle instead of two. The platform team maintains a compatibility matrix that says which Spring AI line works with which Boot line and which internal starter version wraps them.

The dates in such a matrix must come from the projects' own release notes, checked when the plan is written, not from memory. Release plans for young frameworks move, and committing a company-wide date to a milestone that slips by a quarter damages trust in the platform team.

Example compatibility matrix (check versions before committing dates)
Internal AI starterSpring Boot lineSpring AI lineStatus
ai-starter 2.x3.4 and 3.51.0 and 1.1supported, default today
ai-starter 3.x4.0next major (2.x)pilot with two services
ai-starter 1.x3.3milestone buildsend of support, migrate
One row per supported combination, owned by the platform team.

5Judging an Upgrade by Behaviour, Not Compilation

A green build after an AI framework upgrade tells us very little. What we need to know is whether the summaries are still correct, the JSON still parses, the latency is still acceptable and the token cost has not doubled. So every AI feature keeps an evaluation suite: a few hundred real inputs with known good outputs or scoring rules, run before and after the upgrade on the same model. We compare format compliance, accuracy measured by rules or human-reviewed samples, average output length and cost per call.

Observability is the second half. Spring AI publishes Micrometer observations for model calls, including token usage, so dashboards can show tokens, latency and error rates per feature. When we roll an upgraded service out to a small share of traffic first, those dashboards tell us within hours whether something changed in production that the evaluation suite missed.

6Reviewing the Choice Every Year

Finally, we treat the framework decision as something we revisit, not something we defend. Once a year the platform group looks at community health (release cadence, open issues, number of active maintainers), vendor support (who funds the project, whether commercial support exists), feature coverage against what teams actually needed, and the cost of switching, which our interfaces have kept low on purpose. If the answer is still Spring AI, we write down why; if another option has clearly overtaken it, the adapter layer means the move is a planned migration rather than a rewrite.

7Follow-up questions

When would you allow a team to use LangChain4j instead?

I would allow it when the team runs outside Spring Boot, for example on Quarkus, which has its own LangChain4j integration, or in plain Java tools, where Spring AI brings little value. I would also allow it when LangChain4j offers a capability the feature truly needs and Spring AI does not have yet, such as a particular agent pattern or integration. The conditions are the same as for any exception: the library stays inside the adapter behind our interface, the team uses the shared gateway and tracing, the choice is written down with a review date, and the team owns its upgrades.

Is wrapping the framework in our own interfaces not just extra code?

It is a small amount of extra code, usually one interface and one adapter per feature. In return, upgrades touch a handful of classes, tests can stub our interface without knowing the framework, and switching providers becomes configuration plus evaluation. What we should avoid is building a full generic abstraction over every framework feature; the interfaces should be shaped by our features, not by the library.

How do you stop teams from drifting onto different versions?

The shared starter imports the Spring AI BOM at a pinned version, and a dependency check in the build pipeline flags services that override it. Dependency update bots open upgrade pull requests centrally, and the compatibility matrix makes the supported combinations visible, so staying current is the easy path.

8Conclusion

In this answer, we saw that AI frameworks are a special upgrade risk because they change quickly and can change behaviour without breaking the build. We contain that risk by pinning versions and keeping framework types inside adapters behind our own interfaces, choosing Spring AI as the primary framework for Spring Boot services while allowing provider SDKs for missing features, timing AI framework majors with Spring Boot majors through a central compatibility matrix, judging every upgrade with evaluation suites and observability, and reviewing the choice every year.

What to say in the interviewAbout 90 seconds aloud

Open with

I start from the assumption that this area will keep changing, so my goal is to make change cheap. Every AI feature sits behind an interface we own, and only one adapter class imports Spring AI or any SDK; versions are pinned through the BOM in a shared platform starter, so teams do not drift.

Then, if they want more

For Spring Boot services I make Spring AI the primary framework, because it fits our configuration, observability and testing, and the platform team builds the gateway, retries and redaction into the starter once. Teams can use a provider SDK inside their adapter when the framework lacks a feature, and I write those exceptions down.

Since the next Spring AI major is tied to Spring Boot 4, I plan both upgrades as one wave and keep a compatibility matrix centrally, checking the projects' release notes before committing dates.

I do not accept a green build as proof that an upgrade is safe: each feature has an evaluation suite that we run before and after, and we watch tokens, latency and error rates per feature during a gradual rollout. Once a year we review the choice against community health, vendor support and switching cost.

I would allow LangChain4j where a team is not on Spring Boot, such as Quarkus, or needs a capability Spring AI does not have, as long as it stays behind our interfaces.

About this answer

Last updated
12 November 2026
Versions it names
Spring Boot 4, Spring Framework 7
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring AI reference
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Generative AI frameworks for Java (Spring AI, LangChain4j, provider SDKs) change...": https://scrivio-interview-library.netlify.app/spring-boot/spring-ai/a79febed13/