Skip to content

Commit 5050467

Browse files
sobychackomarkpollack
authored andcommitted
Migrate vector store auto-configurations to dedicated modules
Move vector store auto-configuration classes to dedicated modules under auto-configurations/vector-stores/: - Creates separate modules for Cassandra, Chroma, Elasticsearch, GemFire, HanaDB, MariaDB, MongoDB Atlas, Neo4j, OpenSearch, Oracle, PGVector, and Redis vector stores - Updates package names to follow the pattern org.springframework.ai.vectorstore.<implementation>.autoconfigure - Renames corresponding starter modules to follow the pattern spring-ai-starter-vector-store-<implementation> - Updates import paths in affected classes - Relocates test resources alongside their respective implementations - Updates imports in spring-ai-spring-boot-docker-compose and spring-ai-spring-boot-testcontainers This change improves modularity by allowing each vector store implementation to be independently versioned and maintained, following the migration pattern established with previous vector store autoconfiguraiton and starters . Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
1 parent 448a1ae commit 5050467

File tree

108 files changed

+1754
-395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1754
-395
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2023-2025 the original author or authors.
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ https://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xmlns="http://maven.apache.org/POM/4.0.0"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
21+
<modelVersion>4.0.0</modelVersion>
22+
<parent>
23+
<groupId>org.springframework.ai</groupId>
24+
<artifactId>spring-ai</artifactId>
25+
<version>1.0.0-SNAPSHOT</version>
26+
<relativePath>../../../pom.xml</relativePath>
27+
</parent>
28+
<artifactId>spring-ai-autoconfigure-vector-store-cassandra</artifactId>
29+
<packaging>jar</packaging>
30+
<name>Spring AI Auto Configuration for Cassandra vector store</name>
31+
<description>Spring AI Auto Configuration for Cassandra vector store</description>
32+
<url>https://github.com/spring-projects/spring-ai</url>
33+
34+
<scm>
35+
<url>https://github.com/spring-projects/spring-ai</url>
36+
<connection>git://github.com/spring-projects/spring-ai.git</connection>
37+
<developerConnection>git@github.com:spring-projects/spring-ai.git</developerConnection>
38+
</scm>
39+
40+
<dependencies>
41+
<!-- production dependencies -->
42+
<dependency>
43+
<groupId>org.springframework.ai</groupId>
44+
<artifactId>spring-ai-cassandra-store</artifactId>
45+
<version>${project.parent.version}</version>
46+
<optional>true</optional>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.springframework.boot</groupId>
50+
<artifactId>spring-boot-starter</artifactId>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.springframework.boot</groupId>
54+
<artifactId>spring-boot-configuration-processor</artifactId>
55+
<optional>true</optional>
56+
</dependency>
57+
<!-- test dependencies -->
58+
<dependency>
59+
<groupId>org.springframework.ai</groupId>
60+
<artifactId>spring-ai-test</artifactId>
61+
<version>${project.parent.version}</version>
62+
<scope>test</scope>
63+
</dependency>
64+
<dependency>
65+
<groupId>org.springframework.boot</groupId>
66+
<artifactId>spring-boot-starter-test</artifactId>
67+
<scope>test</scope>
68+
</dependency>
69+
<dependency>
70+
<groupId>org.springframework.boot</groupId>
71+
<artifactId>spring-boot-testcontainers</artifactId>
72+
<scope>test</scope>
73+
</dependency>
74+
<dependency>
75+
<groupId>org.testcontainers</groupId>
76+
<artifactId>testcontainers</artifactId>
77+
<scope>test</scope>
78+
</dependency>
79+
<dependency>
80+
<groupId>org.testcontainers</groupId>
81+
<artifactId>junit-jupiter</artifactId>
82+
<scope>test</scope>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.awaitility</groupId>
86+
<artifactId>awaitility</artifactId>
87+
<scope>test</scope>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.testcontainers</groupId>
91+
<artifactId>cassandra</artifactId>
92+
<scope>test</scope>
93+
</dependency>
94+
<dependency>
95+
<groupId>org.springframework.ai</groupId>
96+
<artifactId>spring-ai-transformers</artifactId>
97+
<version>${project.parent.version}</version>
98+
<scope>test</scope>
99+
</dependency>
100+
</dependencies>
101+
</project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.ai.autoconfigure.vectorstore.cassandra;
17+
package org.springframework.ai.vectorstore.cassandra.autoconfigure;
1818

1919
import java.time.Duration;
2020

spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/cassandra/CassandraVectorStoreProperties.java renamed to auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-cassandra/src/main/java/org/springframework/ai/vectorstore/cassandra/autoconfigure/CassandraVectorStoreProperties.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.ai.autoconfigure.vectorstore.cassandra;
17+
package org.springframework.ai.vectorstore.cassandra.autoconfigure;
1818

19-
import com.google.api.client.util.Preconditions;
2019
import org.slf4j.Logger;
2120
import org.slf4j.LoggerFactory;
2221

2322
import org.springframework.ai.vectorstore.properties.CommonVectorStoreProperties;
2423
import org.springframework.ai.vectorstore.cassandra.CassandraVectorStore;
2524
import org.springframework.boot.context.properties.ConfigurationProperties;
25+
import org.springframework.util.Assert;
2626

2727
/**
2828
* Configuration properties for Cassandra Vector Store.
@@ -104,7 +104,7 @@ public int getFixedThreadPoolExecutorSize() {
104104
}
105105

106106
public void setFixedThreadPoolExecutorSize(int fixedThreadPoolExecutorSize) {
107-
Preconditions.checkArgument(0 < fixedThreadPoolExecutorSize);
107+
Assert.state(0 < fixedThreadPoolExecutorSize, "Thread-pool size must be greater than zero");
108108
this.fixedThreadPoolExecutorSize = fixedThreadPoolExecutorSize;
109109
}
110110

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Copyright 2025-2025 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
org.springframework.ai.vectorstore.cassandra.autoconfigure.CassandraVectorStoreAutoConfiguration
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.ai.autoconfigure.vectorstore.cassandra;
17+
package org.springframework.ai.vectorstore.cassandra.autoconfigure;
1818

1919
import java.util.List;
2020
import java.util.Map;
@@ -30,6 +30,7 @@
3030
import org.springframework.ai.document.Document;
3131
import org.springframework.ai.embedding.EmbeddingModel;
3232
import org.springframework.ai.observation.conventions.VectorStoreProvider;
33+
import org.springframework.ai.test.vectorstore.ObservationTestUtil;
3334
import org.springframework.ai.transformers.TransformersEmbeddingModel;
3435
import org.springframework.ai.vectorstore.SearchRequest;
3536
import org.springframework.ai.vectorstore.VectorStore;
@@ -41,7 +42,6 @@
4142
import org.springframework.context.annotation.Configuration;
4243

4344
import static org.assertj.core.api.Assertions.assertThat;
44-
import static org.springframework.ai.autoconfigure.vectorstore.observation.ObservationTestUtil.assertObservationRegistry;
4545

4646
/**
4747
* @author Mick Semb Wever
@@ -82,7 +82,7 @@ void addAndSearch() {
8282
TestObservationRegistry observationRegistry = context.getBean(TestObservationRegistry.class);
8383
vectorStore.add(this.documents);
8484

85-
assertObservationRegistry(observationRegistry, VectorStoreProvider.CASSANDRA,
85+
ObservationTestUtil.assertObservationRegistry(observationRegistry, VectorStoreProvider.CASSANDRA,
8686
VectorStoreObservationContext.Operation.ADD);
8787
observationRegistry.clear();
8888

@@ -95,7 +95,7 @@ void addAndSearch() {
9595
assertThat(resultDoc.getText()).contains(
9696
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
9797

98-
assertObservationRegistry(observationRegistry, VectorStoreProvider.CASSANDRA,
98+
ObservationTestUtil.assertObservationRegistry(observationRegistry, VectorStoreProvider.CASSANDRA,
9999
VectorStoreObservationContext.Operation.QUERY);
100100
observationRegistry.clear();
101101

@@ -105,7 +105,7 @@ void addAndSearch() {
105105
results = vectorStore.similaritySearch(SearchRequest.builder().query("Spring").topK(1).build());
106106
assertThat(results).isEmpty();
107107

108-
assertObservationRegistry(observationRegistry, VectorStoreProvider.CASSANDRA,
108+
ObservationTestUtil.assertObservationRegistry(observationRegistry, VectorStoreProvider.CASSANDRA,
109109
VectorStoreObservationContext.Operation.DELETE);
110110
observationRegistry.clear();
111111
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.ai.autoconfigure.vectorstore.cassandra;
17+
package org.springframework.ai.vectorstore.cassandra.autoconfigure;
1818

1919
import org.junit.jupiter.api.Test;
2020

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2023-2025 the original author or authors.
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ https://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xmlns="http://maven.apache.org/POM/4.0.0"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
21+
<modelVersion>4.0.0</modelVersion>
22+
<parent>
23+
<groupId>org.springframework.ai</groupId>
24+
<artifactId>spring-ai</artifactId>
25+
<version>1.0.0-SNAPSHOT</version>
26+
<relativePath>../../../pom.xml</relativePath>
27+
</parent>
28+
<artifactId>spring-ai-autoconfigure-vector-store-chroma</artifactId>
29+
<packaging>jar</packaging>
30+
<name>Spring AI Auto Configuration for Chroma vector store</name>
31+
<description>Spring AI Auto Configuration for Chroma vector store</description>
32+
<url>https://github.com/spring-projects/spring-ai</url>
33+
34+
<scm>
35+
<url>https://github.com/spring-projects/spring-ai</url>
36+
<connection>git://github.com/spring-projects/spring-ai.git</connection>
37+
<developerConnection>git@github.com:spring-projects/spring-ai.git</developerConnection>
38+
</scm>
39+
40+
<dependencies>
41+
<!-- production dependencies -->
42+
<dependency>
43+
<groupId>org.springframework.ai</groupId>
44+
<artifactId>spring-ai-chroma-store</artifactId>
45+
<version>${project.parent.version}</version>
46+
<optional>true</optional>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.springframework.boot</groupId>
50+
<artifactId>spring-boot-starter</artifactId>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.springframework.boot</groupId>
54+
<artifactId>spring-boot-configuration-processor</artifactId>
55+
<optional>true</optional>
56+
</dependency>
57+
<!-- test dependencies -->
58+
<dependency>
59+
<groupId>org.springframework.ai</groupId>
60+
<artifactId>spring-ai-test</artifactId>
61+
<version>${project.parent.version}</version>
62+
<scope>test</scope>
63+
</dependency>
64+
<dependency>
65+
<groupId>org.springframework.boot</groupId>
66+
<artifactId>spring-boot-starter-test</artifactId>
67+
<scope>test</scope>
68+
</dependency>
69+
<dependency>
70+
<groupId>org.springframework.boot</groupId>
71+
<artifactId>spring-boot-testcontainers</artifactId>
72+
<scope>test</scope>
73+
</dependency>
74+
<dependency>
75+
<groupId>org.testcontainers</groupId>
76+
<artifactId>testcontainers</artifactId>
77+
<scope>test</scope>
78+
</dependency>
79+
<dependency>
80+
<groupId>org.testcontainers</groupId>
81+
<artifactId>junit-jupiter</artifactId>
82+
<scope>test</scope>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.awaitility</groupId>
86+
<artifactId>awaitility</artifactId>
87+
<scope>test</scope>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.testcontainers</groupId>
91+
<artifactId>chromadb</artifactId>
92+
<scope>test</scope>
93+
</dependency>
94+
<dependency>
95+
<groupId>org.springframework.ai</groupId>
96+
<artifactId>spring-ai-transformers</artifactId>
97+
<version>${project.parent.version}</version>
98+
<scope>test</scope>
99+
</dependency>
100+
</dependencies>
101+
</project>

spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/chroma/ChromaApiProperties.java renamed to auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-chroma/src/main/java/org/springframework/ai/vectorstore/chroma/autoconfigure/ChromaApiProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.ai.autoconfigure.vectorstore.chroma;
17+
package org.springframework.ai.vectorstore.chroma.autoconfigure;
1818

1919
import org.springframework.boot.context.properties.ConfigurationProperties;
2020

spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/chroma/ChromaConnectionDetails.java renamed to auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-chroma/src/main/java/org/springframework/ai/vectorstore/chroma/autoconfigure/ChromaConnectionDetails.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.ai.autoconfigure.vectorstore.chroma;
17+
package org.springframework.ai.vectorstore.chroma.autoconfigure;
1818

1919
import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails;
2020

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.ai.autoconfigure.vectorstore.chroma;
17+
package org.springframework.ai.vectorstore.chroma.autoconfigure;
1818

1919
import com.fasterxml.jackson.databind.ObjectMapper;
2020
import io.micrometer.observation.ObservationRegistry;

0 commit comments

Comments
 (0)