Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
•••
AI & KI NachrichtenYour A.I. Questions Answered(29.09.2026 um 11:43 Uhr)
••
Windows Tipps & SecurityRundfunkbeitrag: Neues Online-Tool erspart Ihnen teure Nachzahlung(29.09.2026 um 11:47 Uhr)
•
Windows Tipps & SecurityPeaZip(29.09.2026 um 12:00 Uhr)
•
Linux Tipps & HardeningUSN-8818-3: Linux kernel vulnerabilities(29.09.2026 um 11:19 Uhr)
••••••
AI & KI NachrichtenYour A.I. Questions Answered(29.09.2026 um 11:43 Uhr)
••
Windows Tipps & SecurityRundfunkbeitrag: Neues Online-Tool erspart Ihnen teure Nachzahlung(29.09.2026 um 11:47 Uhr)
•
Windows Tipps & SecurityPeaZip(29.09.2026 um 12:00 Uhr)
•
Linux Tipps & HardeningUSN-8818-3: Linux kernel vulnerabilities(29.09.2026 um 11:19 Uhr)
•••
Intelligence View
⚡ tsecurity.de Intelligence

RAG with Spring Boot — Embeddings and Vector Search Step by Step (2026)

Canonical URL: Republished from munonye.com. Full code on GitHub. Learn how to build a RAG Spring Boot tutorial pipeline that answers questions from your own documents. This post extends the AI Developer Tutorials series and connects to…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Canonical URL: Republished from munonye.com. Full code on GitHub.




Learn how to build a RAG Spring Boot tutorial pipeline that answers questions from your own documents. This post extends the AI Developer Tutorials series and connects to M7-A Spring AI REST basics.






RAG architecture






Documents → chunk → embed → VectorStore
User question → embed → top-K similar chunks → prompt → LLM → answer









Dependencies






<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-pgvector-store-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
</dependency>









Ingestion service






@Service
public class DocumentIngestionService {
private final VectorStore vectorStore;
private final Resource docsFolder;

public DocumentIngestionService(VectorStore vectorStore,
@Value("classpath:docs/") Resource docsFolder) {
this.vectorStore = vectorStore;
this.docsFolder = docsFolder;
}

public void ingestAll() throws IOException {
for (Resource file : docsFolder.getFile().listFiles()) {
String text = Files.readString(file.getFile().toPath());
List<Document> chunks = split(text, 800, 100);
vectorStore.add(chunks);
}
}

private List<Document> split(String text, int size, int overlap) {
List<Document> out = new ArrayList<>();
for (int i = 0; i < text.length(); i += size - overlap) {
out.add(new Document(text.substring(i, Math.min(i + size, text.length()))));
}
return out;
}
}









Question endpoint






@PostMapping("/api/ask")
public AnswerResponse ask(@RequestBody QuestionRequest req) {
List<Document> similar = vectorStore.similaritySearch(req.question(), 5);
String context = similar.stream().map(Document::getContent).collect(Collectors.joining("\n---\n"));
String answer = chatClient.prompt()
.system("Answer only from the context below. Say 'I don't know' if not found.\n" + context)
.user(req.question())
.call()
.content();
return new AnswerResponse(answer);
}









Next: function calling from Angular



M8-B — Structured JSON from LLMs in Angular






Full tutorial: RAG with Spring Boot — Embeddings and Vector Search Step by Step (2026)



Kindson Munonye — GitHub · LinkedIn · About

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten RAG with Spring Boot — Embeddings and Vector Search Step by Step (2026)

Thematisch verwandte Begriffe: with, Spring, Boot, Embeddings · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-102241 | A vulnerability was determined in Netcore NAP930 0.1.241010.141410. Thi…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag