SlideShare a Scribd company logo
Java and AI with
LangChain4j
Code the future with AI
Ed Burns @edburns
Principal Architect
PENDING download link
Ed Burns professional biography
 Client
 NCSA Mosaic (1994)
 SGI Cosmo Web Authoring
 Sun Netscape 6 OJI
 Server
 J2EE JSF (2002)
 Oracle Java EE
 Servlet, JSF, Bean Validation, etc.
 Cloud
 Java Champion
 Microsoft Azure Cloud (2019)
 Jakarta EE 11 committer and release coordinator
 Books
Change in content from posted agenda
 Still 100% Java and AI with LangChain4j.
 Removed content:
 After a brief look at the landscape.
 How you use it to perform the most popular AI usage pattern:
Retrieval Augmented Generation (RAG).
 Added content:
 langchain4j-microprofile-jakarta.
 If you want the RAG content, I recommend Easy RAG with
LangChain4J and Docker by Julien Dubois.
JUG Tour Around JavaLand 2025
Breaking Jakarta EE news
 Jakarta EE 11 Web Profile started release review ballot Monday!
 https://github.com/jakartaee/specifications/pull/802
 https://deploy-preview-802--jakartaee-
specifications.netlify.app/specifications/webprofile/11/
 Many EE 12 component specifications in Plan Review stage.
 MicroProfile is discussing whether and how to host MicroProfile in
Jakarta EE.
 The need for a unified Config solution for EE 12.
 Coincidentally timed soon after Evolving our middleware strategy blog post
from Red Hat.
AI related career advice
Everyone I know admits: AI is moving faster than
anything that has come before
https://aka.ms/DeveloperCareerMasterplan/slides https://aka.ms/RockStarProgrammerSecrets
Scott Hanselman: Let’s all just
chill
From a trust perspective
 Very important to keep the
“intelligence” in AI in
perspective.
 LLMs cannot answer simple
questions such as “Which
episode of Gilligan’s Island was
about mind reading?”
 The question that no LLM can answer and
why it is important
https://www.mindprison.cc/p/the-question-that-no-llm-can-answer
Java meets AI
Content from Emmanuel Hugonnet http://www.ehsavoie.com/
Jakarta EE meets AI
smallrye-llm
langchain4j-
microprofile
-jakarta
Microprofile config
Microprofile Fault Tolerance Microprofile
OpenTelemetry
CDI
Content from Emmanuel Hugonnet http://www.ehsavoie.com/
Components of LangChain4J
Content from Emmanuel Hugonnet http://www.ehsavoie.com/
Quick look at LangChain4j examples
 https://github.com/langchain4j/langchain4j-examples
Components of SmallRye LLM/LangChain4J Jakarta
1. AI Service Interface Processing:
o Detects interfaces annotated with @RegisterAIService
o Generates proxy implementations using LangChain4J
o Makes them available as CDI beans
2. Plugin Bean Creation:
o Reads configuration from properties with smallrye.llm.plugin.* prefix
o Creates beans for LangChain4J components (models, embedding stores)
o Makes these components available for injection
3. MicroProfile Config Integration:
o Translates properties to LangChain4J configuration
o Handles environment variable substitution (e.g., ${azure.openai.api.key})
4. Fault Tolerance:
o Provides integration with MicroProfile Fault Tolerance
o Adds resilience to AI service calls
5. Telemetry:
o Provides observability for AI service calls
o Integrates with OpenTelemetry
Some Code
CDI Injection
Injection.java
@Inject
@Named(value = "ollama")
ChatLanguageModel chatModel;
@Inject
@Named(value = "embedding-store-retriever")
ContentRetriever retriever;
Content from Emmanuel Hugonnet http://www.ehsavoie.com/
AI Service
SimpleAIService.java
@RegisterAIService(chatLanguageModelName = "ollama", tools =
{org.wildfly.ai.websocket.Weather.class,org.wildfly.ai.websocket.Cal
culator.class}, scope = SessionScoped.class)
public interface SimpleAIService {
@SystemMessage("""
You are an AI named Bob answering general question.
Your response must be polite, use the same language
as the question, and be relevant to the question.""")
String chat(@UserMessage String question);
}
Content from Emmanuel Hugonnet http://www.ehsavoie.com/
Another approach, with MCP
But what is MCP?
But what is MCP?
https://modelcontextprotocol.io/
But what is MCP?
 https://github.com/modelcontextprotocol/servers
Demo
Content from Emmanuel Hugonnet http://www.ehsavoie.com/
MCP
Server
MCP tools workflow
MCP
Server
Web
Application
LLM
MCP
Server
1
2 3
4
MCP
Server
5
6
Content from Emmanuel Hugonnet http://www.ehsavoie.com/
MCP
Server
Database
Filesystem
Message queue
JavaFX
AI Service with MCP Tools
SimpleAIService.java
@RegisterAIService(streamingChatLanguageModelName= "streaming-
ollama", toolProviderName = "mcp")
public interface ChatAiService {
@SystemMessage("""
You are an AI named Bob answering general question.
Your response must be polite, use the same language
as the question, and be relevant to the question.""")
TokenStream streamingChat(@UserMessage String question);
}
Content from Emmanuel Hugonnet http://www.ehsavoie.com/
Demo
Content from Emmanuel Hugonnet http://www.ehsavoie.com/
Conclusion
Content from Emmanuel Hugonnet http://www.ehsavoie.com/
What we saw
External configuration instead of code
CDI Injection
AI Service support
Cross-vendors: Micronaute, OpenLiberty, Quarkus, WildFly
Enterprise ready : OpenTelemetry / Fault Tolerance / MCP
Makes LangChain4J even easier to use !
Content from Emmanuel Hugonnet http://www.ehsavoie.com/
Resources
• LangChain4J:
o https://docs.langchain4j.dev/
• Model Context Protocol:
o https://spec.modelcontextprotocol.io/
• smallrye-llm: a cross vendor LangChain4J -CDI integration library
o https://github.com/smallrye/smallrye-llm
• WildFly AI Feature Pack:
o https://github.com/wildfly-extras/wildfly-ai-feature-pack
• WildFly MCP: to interact with WildFly servers through MCP
o https://github.com/wildfly-extras/wildfly-mcp
• Admin your WildFly with LLM and MCP
o https://www.youtube.com/watch?v=wg1hAdOoe2w
• Making WildFly Glow with Intelligence:
o https://www.wildfly.org/news/2025/02/10/Glowing-with-AI/
• Playing with Generative AI with WildFly:
o https://www.wildfly.org/news/2024/11/04/WildFly-playing-with-generative-ai/
Thank you
Ed Burns
@edburns on most of the things
• Please fill out this survey
• 5 winners will be chosen to win a $100 digital gift card
• https://aka.ms/edburns/survey2025
1.What is your key decision making process when it comes to app
modernization?
2.What’s your key challenge when modernizing your Java workload?
3.Are you a Java only shop or multiple language shop?
4.What is the tech stack/framework for your Java apps?
5.When migrating, what is your primary destination on cloud? What
platform are you choosing? VM? PaaS? Containers? Why?
6.How did you or your team make the above decisions?

More Related Content

PDF
Java and AI with LangChain4j: Integrating Jakarta EE and LLMs
PDF
Java and AI with LangChain4j: Jakarta EE gets AI
PDF
Adobe Photoshop 2025 Free crack Download
PDF
Java and AI with LangChain4j: Jakarta EE and AI
PPTX
Deliver AI infused app innovation with Open Liberty on AKS
DOCX
Project report for final year project
PPT
Developing Java Web Applications
PPTX
CTE 323 - Lecture 1.pptx
Java and AI with LangChain4j: Integrating Jakarta EE and LLMs
Java and AI with LangChain4j: Jakarta EE gets AI
Adobe Photoshop 2025 Free crack Download
Java and AI with LangChain4j: Jakarta EE and AI
Deliver AI infused app innovation with Open Liberty on AKS
Project report for final year project
Developing Java Web Applications
CTE 323 - Lecture 1.pptx

Similar to Java and AI with LangChain4j: Jakarta EE and SmallRye LLM (20)

PDF
Apache Flex and the imperfect Web
PDF
Building and deploying AI agents in Java
PPTX
Django Seminar
ODP
A Good PHP Framework For Beginners Like Me!
PPTX
Spring MVC framework
PDF
Top 11 Front-End Web Development Tools To Consider in 2020
PPT
Eclipse Demo Camp 2010 - Eclipse e4 – The Status and the Future
PPTX
Web components Introduction
PDF
A comparative study of laravel and symfony PHP frameworks
PPTX
C,c++,java,php,.net training institute in delhi, best training institute for ...
PDF
Python Web Framework – A Detailed List of Web Frameworks in Python
PDF
OpenNTF Webinar 05/07/13: OpenNTF - The IBM Collaboration Solutions App Dev C...
DOCX
Symfony framework-An overview and usability for web development
PPT
Agile Software Development by Sencha
PPTX
Prototyping UX Solutions with Playgrounds and Lightning Web Components
PDF
Java Is A Programming Dialect And Registering Stage Essay
PPTX
Mobile applications chapter 4
PDF
Top 10 python frameworks for web development in 2020
PPSX
Java Semimar Slide (Cetpa)
PPSX
Java Semimar Slide (Cetpa)
Apache Flex and the imperfect Web
Building and deploying AI agents in Java
Django Seminar
A Good PHP Framework For Beginners Like Me!
Spring MVC framework
Top 11 Front-End Web Development Tools To Consider in 2020
Eclipse Demo Camp 2010 - Eclipse e4 – The Status and the Future
Web components Introduction
A comparative study of laravel and symfony PHP frameworks
C,c++,java,php,.net training institute in delhi, best training institute for ...
Python Web Framework – A Detailed List of Web Frameworks in Python
OpenNTF Webinar 05/07/13: OpenNTF - The IBM Collaboration Solutions App Dev C...
Symfony framework-An overview and usability for web development
Agile Software Development by Sencha
Prototyping UX Solutions with Playgrounds and Lightning Web Components
Java Is A Programming Dialect And Registering Stage Essay
Mobile applications chapter 4
Top 10 python frameworks for web development in 2020
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
Ad

More from Edward Burns (20)

PDF
Jakarta EE 11: What's New and Why You Should Care
PDF
20250403-trusted-ai-favorite-ide-javaland.pdf
PDF
A survey of cloud readiness for Jakarta EE 11
PDF
How to get trusted AI in your favorite IDE
PDF
How to get trusted AI in your favorite IDE
PDF
How to get trusted AI in your favorite IDE
PDF
How to get trusted AI in your favorite IDE
PPTX
2024-09-10 Jacksonville JUG Java on Azure with AI
PPTX
DevTalks Romania: Prepare for Jakarta EE 11
PDF
Developer Career Masterplan
PPTX
Jakarta EE 11 Status Update​
PDF
Sponsored Session: Please touch that dial!
PDF
How modernizing enterprise applications gives you a competitive advantage
PDF
Wie Azure Jakarta EE Nutzt
PDF
Practical lessons from customers performing digital transformation with Azure
PDF
wls-azure-devnexus-2022.pdf
PDF
Jakarta EE und Microprofile sind bei Azure zu Hause
PDF
Java on Your Terms with Azure
PDF
Wars I’ve Seen From Java EE to Spring and more, Azure has you covered
PDF
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
Jakarta EE 11: What's New and Why You Should Care
20250403-trusted-ai-favorite-ide-javaland.pdf
A survey of cloud readiness for Jakarta EE 11
How to get trusted AI in your favorite IDE
How to get trusted AI in your favorite IDE
How to get trusted AI in your favorite IDE
How to get trusted AI in your favorite IDE
2024-09-10 Jacksonville JUG Java on Azure with AI
DevTalks Romania: Prepare for Jakarta EE 11
Developer Career Masterplan
Jakarta EE 11 Status Update​
Sponsored Session: Please touch that dial!
How modernizing enterprise applications gives you a competitive advantage
Wie Azure Jakarta EE Nutzt
Practical lessons from customers performing digital transformation with Azure
wls-azure-devnexus-2022.pdf
Jakarta EE und Microprofile sind bei Azure zu Hause
Java on Your Terms with Azure
Wars I’ve Seen From Java EE to Spring and more, Azure has you covered
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
Ad

Recently uploaded (20)

PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Transform Your Business with a Software ERP System
PDF
AI in Product Development-omnex systems
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
medical staffing services at VALiNTRY
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Upgrade and Innovation Strategies for SAP ERP Customers
Operating system designcfffgfgggggggvggggggggg
How to Migrate SBCGlobal Email to Yahoo Easily
Transform Your Business with a Software ERP System
AI in Product Development-omnex systems
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Reimagine Home Health with the Power of Agentic AI​
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
medical staffing services at VALiNTRY
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Design an Analysis of Algorithms II-SECS-1021-03
Design an Analysis of Algorithms I-SECS-1021-03
Wondershare Filmora 15 Crack With Activation Key [2025
Odoo POS Development Services by CandidRoot Solutions
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
Digital Strategies for Manufacturing Companies
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf

Java and AI with LangChain4j: Jakarta EE and SmallRye LLM

  • 1. Java and AI with LangChain4j Code the future with AI Ed Burns @edburns Principal Architect PENDING download link
  • 2. Ed Burns professional biography  Client  NCSA Mosaic (1994)  SGI Cosmo Web Authoring  Sun Netscape 6 OJI  Server  J2EE JSF (2002)  Oracle Java EE  Servlet, JSF, Bean Validation, etc.  Cloud  Java Champion  Microsoft Azure Cloud (2019)  Jakarta EE 11 committer and release coordinator  Books
  • 3. Change in content from posted agenda  Still 100% Java and AI with LangChain4j.  Removed content:  After a brief look at the landscape.  How you use it to perform the most popular AI usage pattern: Retrieval Augmented Generation (RAG).  Added content:  langchain4j-microprofile-jakarta.  If you want the RAG content, I recommend Easy RAG with LangChain4J and Docker by Julien Dubois.
  • 4. JUG Tour Around JavaLand 2025
  • 5. Breaking Jakarta EE news  Jakarta EE 11 Web Profile started release review ballot Monday!  https://github.com/jakartaee/specifications/pull/802  https://deploy-preview-802--jakartaee- specifications.netlify.app/specifications/webprofile/11/  Many EE 12 component specifications in Plan Review stage.  MicroProfile is discussing whether and how to host MicroProfile in Jakarta EE.  The need for a unified Config solution for EE 12.  Coincidentally timed soon after Evolving our middleware strategy blog post from Red Hat.
  • 7. Everyone I know admits: AI is moving faster than anything that has come before https://aka.ms/DeveloperCareerMasterplan/slides https://aka.ms/RockStarProgrammerSecrets
  • 8. Scott Hanselman: Let’s all just chill From a trust perspective  Very important to keep the “intelligence” in AI in perspective.  LLMs cannot answer simple questions such as “Which episode of Gilligan’s Island was about mind reading?”  The question that no LLM can answer and why it is important https://www.mindprison.cc/p/the-question-that-no-llm-can-answer
  • 9. Java meets AI Content from Emmanuel Hugonnet http://www.ehsavoie.com/
  • 10. Jakarta EE meets AI smallrye-llm langchain4j- microprofile -jakarta Microprofile config Microprofile Fault Tolerance Microprofile OpenTelemetry CDI Content from Emmanuel Hugonnet http://www.ehsavoie.com/
  • 11. Components of LangChain4J Content from Emmanuel Hugonnet http://www.ehsavoie.com/
  • 12. Quick look at LangChain4j examples  https://github.com/langchain4j/langchain4j-examples
  • 13. Components of SmallRye LLM/LangChain4J Jakarta 1. AI Service Interface Processing: o Detects interfaces annotated with @RegisterAIService o Generates proxy implementations using LangChain4J o Makes them available as CDI beans 2. Plugin Bean Creation: o Reads configuration from properties with smallrye.llm.plugin.* prefix o Creates beans for LangChain4J components (models, embedding stores) o Makes these components available for injection 3. MicroProfile Config Integration: o Translates properties to LangChain4J configuration o Handles environment variable substitution (e.g., ${azure.openai.api.key}) 4. Fault Tolerance: o Provides integration with MicroProfile Fault Tolerance o Adds resilience to AI service calls 5. Telemetry: o Provides observability for AI service calls o Integrates with OpenTelemetry
  • 15. CDI Injection Injection.java @Inject @Named(value = "ollama") ChatLanguageModel chatModel; @Inject @Named(value = "embedding-store-retriever") ContentRetriever retriever; Content from Emmanuel Hugonnet http://www.ehsavoie.com/
  • 16. AI Service SimpleAIService.java @RegisterAIService(chatLanguageModelName = "ollama", tools = {org.wildfly.ai.websocket.Weather.class,org.wildfly.ai.websocket.Cal culator.class}, scope = SessionScoped.class) public interface SimpleAIService { @SystemMessage(""" You are an AI named Bob answering general question. Your response must be polite, use the same language as the question, and be relevant to the question.""") String chat(@UserMessage String question); } Content from Emmanuel Hugonnet http://www.ehsavoie.com/
  • 18. But what is MCP?
  • 19. But what is MCP? https://modelcontextprotocol.io/
  • 20. But what is MCP?  https://github.com/modelcontextprotocol/servers
  • 21. Demo Content from Emmanuel Hugonnet http://www.ehsavoie.com/
  • 22. MCP Server MCP tools workflow MCP Server Web Application LLM MCP Server 1 2 3 4 MCP Server 5 6 Content from Emmanuel Hugonnet http://www.ehsavoie.com/ MCP Server Database Filesystem Message queue JavaFX
  • 23. AI Service with MCP Tools SimpleAIService.java @RegisterAIService(streamingChatLanguageModelName= "streaming- ollama", toolProviderName = "mcp") public interface ChatAiService { @SystemMessage(""" You are an AI named Bob answering general question. Your response must be polite, use the same language as the question, and be relevant to the question.""") TokenStream streamingChat(@UserMessage String question); } Content from Emmanuel Hugonnet http://www.ehsavoie.com/
  • 24. Demo Content from Emmanuel Hugonnet http://www.ehsavoie.com/
  • 25. Conclusion Content from Emmanuel Hugonnet http://www.ehsavoie.com/
  • 26. What we saw External configuration instead of code CDI Injection AI Service support Cross-vendors: Micronaute, OpenLiberty, Quarkus, WildFly Enterprise ready : OpenTelemetry / Fault Tolerance / MCP Makes LangChain4J even easier to use ! Content from Emmanuel Hugonnet http://www.ehsavoie.com/
  • 27. Resources • LangChain4J: o https://docs.langchain4j.dev/ • Model Context Protocol: o https://spec.modelcontextprotocol.io/ • smallrye-llm: a cross vendor LangChain4J -CDI integration library o https://github.com/smallrye/smallrye-llm • WildFly AI Feature Pack: o https://github.com/wildfly-extras/wildfly-ai-feature-pack • WildFly MCP: to interact with WildFly servers through MCP o https://github.com/wildfly-extras/wildfly-mcp • Admin your WildFly with LLM and MCP o https://www.youtube.com/watch?v=wg1hAdOoe2w • Making WildFly Glow with Intelligence: o https://www.wildfly.org/news/2025/02/10/Glowing-with-AI/ • Playing with Generative AI with WildFly: o https://www.wildfly.org/news/2024/11/04/WildFly-playing-with-generative-ai/
  • 28. Thank you Ed Burns @edburns on most of the things • Please fill out this survey • 5 winners will be chosen to win a $100 digital gift card • https://aka.ms/edburns/survey2025
  • 29. 1.What is your key decision making process when it comes to app modernization? 2.What’s your key challenge when modernizing your Java workload? 3.Are you a Java only shop or multiple language shop? 4.What is the tech stack/framework for your Java apps? 5.When migrating, what is your primary destination on cloud? What platform are you choosing? VM? PaaS? Containers? Why? 6.How did you or your team make the above decisions?