TikaDocumentReader loads documents into Spring AI when an application must accept more than one file format. Based on Apache Tika, it handles formats such as PDF, plain text, Microsoft Word, Excel, and PowerPoint, making it a flexible alternative to a PDF-specific reader. section 4.3.3
In a Spring Boot document-ingestion pipeline, the reader can consume file bytes from Spring Function Catalog and emit Spring AI Document objects. A reactive Flux keeps files moving through the long-running pipeline as they become available; boundedElastic scheduling handles the reader operation without interrupting the reactive flow. section 4.3.3
Registering the reader as a pipeline function
Add the Spring AI Tika reader dependency, then define a bean such as: @Bean Function<Flux<byte[]>, Flux<Document>> documentReader() { return resourceFlux -> resourceFlux.map(fileBytes -> new TikaDocumentReader(new ByteArrayResource(fileBytes)).get().getFirst()).subscribeOn(Schedulers.boundedElastic()); } section 4.3.3
implementation 'org.springframework.ai:spring-ai-tika-document-reader'
Inspect the dependency required to place TikaDocumentReader on the application classpath. section 4.3.3
