This version is still in development and is not considered stable yet. For the latest stable version, please use Spring AI 0.8.1!

Testcontainers

Spring AI provides Spring Boot auto-configuration for establishing a connection to a model service or vector store running via Testcontainers. To enable it, add the following dependency to your project’s Maven pom.xml file:

<dependency>
   <groupId>org.springframework.ai</groupId>
   <artifactId>spring-ai-spring-boot-testcontainers</artifactId>
</dependency>

or to your Gradle build.gradle build file.

dependencies {
    implementation 'org.springframework.ai:spring-ai-spring-boot-testcontainers'
}
Refer to the Dependency Management section to add the Spring AI BOM to your build file.

Service Connections

The following service connection factories are provided in the spring-ai-spring-boot-testcontainers module:

Connection Details

Matched on

ChromaConnectionDetails

Containers of type ChromaDBContainer

MilvusServiceClientConnectionDetails

Containers of type MilvusContainer

OllamaConnectionDetails

Containers of type OllamaContainer

QdrantConnectionDetails

Containers of type QdrantContainer

RedisConnectionDetails

Containers of type RedisStackContainer

WeaviateConnectionDetails

Containers of type WeaviateContainer