Spring / Spring AI interview questions
What DocumentReaders does Spring AI provide for loading content into the RAG pipeline?
A DocumentReader is the entry point of the RAG ingestion pipeline — it reads raw source material and converts it into a List<Document> that can then be chunked and embedded. Spring AI ships several ready-made readers so you do not need to write file-parsing code yourself.
- PdfDocumentReader — reads PDF files using Apache PDFBox. Each page or a configurable page range becomes one Document, with page number stored in metadata.
- TikaDocumentReader — uses Apache Tika to extract text from Word documents, Excel files, PowerPoint presentations, HTML, and more. A single reader handles dozens of formats.
- TextReader — reads plain text files from classpath or filesystem.
- JsonReader — reads JSON documents and can extract specific fields via a JSON pointer.
- PagePdfDocumentReader — a variant of PdfDocumentReader that creates one Document per paragraph rather than per page, improving chunk granularity.
// PDF
List<Document> pdfDocs = new PdfDocumentReader(
new ClassPathResource("handbook.pdf")).get();
// Word / Office files via Tika
List<Document> wordDocs = new TikaDocumentReader(
new FileSystemResource("/data/policy.docx")).get();You can chain readers with splitters and then hand the final chunk list to vectorStore.add(). For web pages, Spring AI does not include a built-in HTML reader as of 1.x — teams typically use JSoup to extract text and wrap it in Document objects manually, or use the ETL pipeline utilities.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
