The most common use case for Artificial Intelligence (AI) in enterprise applications is about integrating with Large Language Models (LLMs) in some way or another. This article explores how you can do that in your new or existing Jakarta EE applications.
Even if there is no specific Jakarta EE specification for Artificial Intelligence, it does not lack for support. One of the greatest advantages of Jakarta EE is how easy it is to integrate with other technologies. When it comes to AI in enterprise applications, there are a couple of alternatives available. LangChain4J has established itself as more or less the industry standard for integrating with AI in Java. A subproject of LangChain4J is LangChain4J-CDI, which is an enterprise CDI extension for LangChain4J that provides seamless integration between LangChain4J and CDI.
An alternative to LangChain4J-CDI is OmniHai. OmniHai provides a consistent, simple API for integrating with AI providers. It can be used with or without CDI. The difference between them is that while LangChain4J is more or less a comprehensive framework for AI integration, OmiHai is a simplistic, lightweight utility API.
The common denominator between these two alternatives is how well they leverage CDI Extensions to integrate with Jakarta EE and provide the programming model Jakarta EE developers are familiar with.
Here is a simple example using LangChain4J CDI to define a simple AI service that is given a simple tool to find the user’s date and time.
@RegisterAIService(tools = {SimpleTool.class})
public interface SimpleToolAiService {
@SystemMessage("You are a helpful assistant.")
String chat(String message);
}
public class SimpleTool {
@Tool("Get the current date and time in the user's timezone")
String getCurrentDateTime() {
return LocalDateTime.now()
.toString();
}
}
The SimpleToolAIService can then be used in your application by injecting it as a CDI bean as shown below.
public class MyApp {
@Inject
private SimpleToolAiService aiService;
// …
}
AI Capable with Jakarta EE 11
There are also other alternatives for integrating with AI from Jakarta EE applications. In fact, any Java library can be used. It is even possible to use Spring AI in Jakarta EE. These libraries can be used directly as is, or be made available for Jakarta EE developers by leveraging the extensibility mechanisms of CDI. So it is safe to say that Jakarta EE is fully capable of offering enterprise-grade integration with AI today.

AI Ready with Jakarta EE 12
Looking forward, the next versions of Jakarta EE will provide even better support for AI integration in enterprise applications. Jakarta EE 12, which is currently being developed, will provide standardised support for NoSQL through the Jakarta NoSQL specification (*). Support for NoSQL data sources is convenient for Retrieval Augmented Generation (RAG). Particularly, vector databases are well-suited for this.
(*) Discussions regarding the inclusion of Jakarta NoSQL in Jakarta EE 12 are currently ongoing.
Full AI support with Jakarta EE 13
The Jakarta Agentic Artificial Intelligence Specification will provide a set of vendor-neutral APIs that make it easy, consistent, and reliable to build, deploy, and run AI agents on Jakarta EE runtimes. This specification is expected to be included in Jakarta EE 13. Work on this version will start as soon as Jakarta EE 12 is ready. With the current two-year release cadence, Jakarta EE 13 can be expected in 2028.
ULTRA AI with Jakarta EE 14
Looking further into the future than the above is probably going to be closer to wild guesses than reality. Especially considering the speed at which this particular field is currently advancing. But it is safe to say that there will be extensive support for AI in Jakarta EE 14. And that support will be enterprise-grade, stable, and robust, just like all Jakarta EE specifications. It is not always about being first. Sometimes it is better to stand on the shoulders of others and build on the collective knowledge gained through experimentation.
Conclusion
By using libraries available, either in combination with CDI or directly, developers can easily integrate with AI systems in their Jakarta EE enterprise applications. The extensibility, power, and simplicity of CDI make this a powerful combination. You can rely on the robustness and flexibility of Jakarta EE while using the tools and libraries needed for the modern enterprise. Future versions of Jakarta EE will provide more native support, thus providing an even smoother experience.
