🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)
🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)

🔧 Programmierung 🕛 vor 1 Monat 10 Min Lesezeit
0

LangChain4j and Spring AI: The Plumbing to make your Java Apps talk to LLMs

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

If you've heard about LangChain and assumed it was a Python thing, that's fair. It mostly was.



LangChain became popular because building with an LLM turns out to involve a lot of repetitive plumbing. You need to manage conversation history, split documents into chunks, generate embeddings, search a vector store, wire up functions the model can call, and parse whatever comes back. None of that is hard, but writing it from scratch for every project gets old fast. LangChain packaged those pieces into reusable components, and the pattern caught on.



The Java ecosystem has that now too, in two flavors. LangChain4j is a Java library built around the same idea, though it was written for Java from the ground up rather than ported over. Spring AI does the same job the Spring way, with auto-configuration and dependency injection, and it hit 2.0 this June.



Both are production ready. Your existing Spring Boot service can call an LLM in about six lines, and you don't need a Python sidecar or a separate service to do it.



The six lines aren't the interesting part, though. What matters is the distance between a chat endpoint that echoes text back and something you'd actually ship: getting typed objects instead of strings, grounding answers in your own documentation, and letting a model trigger real code in your app.



That's what this post covers. We'll build up from hello-world to a service that answers questions about your internal docs and can call your APIs, one step at a time. I'll use Spring AI for the walkthrough since most of us are already in a Boot service, then show what the same thing looks like in LangChain4j so you can pick.



I'm assuming you know Java and Spring Boot, and nothing about AI. No math, no theory, just the parts you need to build something.



One idea first, because it makes everything else fall into place.






The mental model that makes this click




An LLM is a stateless function. Text in, text out. It doesn't remember your last call, can't reach the internet, and knows nothing about your systems.




Everything below is a workaround for that:




  • Remember the conversation? You resend the history.

  • Know your internal docs? You find the relevant pages and paste them in.

  • Check live data? You run the function it asks for and hand back the result.



The model never does anything. Your code does everything. The model produces text, and sometimes that text is a decision about what your code should do next.



That one idea demystifies most of this space. Everything from here is plumbing around a stateless function, and plumbing is something we're already good at.




If you want more background on how LLMs, RAG, and agents fit together before diving in, I wrote about that here:


















9 min read