Skip to content

Commit 92b420c

Browse files
committed
Removing the usage of the config class
1 parent 228056e commit 92b420c

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/cassandra/CassandraVectorStoreProperties.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import org.slf4j.LoggerFactory;
2222

2323
import org.springframework.ai.autoconfigure.vectorstore.CommonVectorStoreProperties;
24-
import org.springframework.ai.vectorstore.cassandra.CassandraVectorStoreConfig;
24+
import org.springframework.ai.vectorstore.cassandra.CassandraVectorStore;
2525
import org.springframework.boot.context.properties.ConfigurationProperties;
2626

2727
/**
@@ -37,19 +37,19 @@ public class CassandraVectorStoreProperties extends CommonVectorStoreProperties
3737

3838
private static final Logger logger = LoggerFactory.getLogger(CassandraVectorStoreProperties.class);
3939

40-
private String keyspace = CassandraVectorStoreConfig.DEFAULT_KEYSPACE_NAME;
40+
private String keyspace = CassandraVectorStore.DEFAULT_KEYSPACE_NAME;
4141

42-
private String table = CassandraVectorStoreConfig.DEFAULT_TABLE_NAME;
42+
private String table = CassandraVectorStore.DEFAULT_TABLE_NAME;
4343

4444
private String indexName = null;
4545

46-
private String contentColumnName = CassandraVectorStoreConfig.DEFAULT_CONTENT_COLUMN_NAME;
46+
private String contentColumnName = CassandraVectorStore.DEFAULT_CONTENT_COLUMN_NAME;
4747

48-
private String embeddingColumnName = CassandraVectorStoreConfig.DEFAULT_EMBEDDING_COLUMN_NAME;
48+
private String embeddingColumnName = CassandraVectorStore.DEFAULT_EMBEDDING_COLUMN_NAME;
4949

5050
private boolean returnEmbeddings = false;
5151

52-
private int fixedThreadPoolExecutorSize = CassandraVectorStoreConfig.DEFAULT_ADD_CONCURRENCY;
52+
private int fixedThreadPoolExecutorSize = CassandraVectorStore.DEFAULT_ADD_CONCURRENCY;
5353

5454
public String getKeyspace() {
5555
return this.keyspace;

spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/vectorstore/cassandra/CassandraVectorStorePropertiesTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

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

21+
import org.springframework.ai.vectorstore.cassandra.CassandraVectorStore;
2122
import org.springframework.ai.vectorstore.cassandra.CassandraVectorStoreConfig;
2223

2324
import static org.assertj.core.api.Assertions.assertThat;
@@ -31,13 +32,12 @@ class CassandraVectorStorePropertiesTests {
3132
@Test
3233
void defaultValues() {
3334
var props = new CassandraVectorStoreProperties();
34-
assertThat(props.getKeyspace()).isEqualTo(CassandraVectorStoreConfig.DEFAULT_KEYSPACE_NAME);
35-
assertThat(props.getTable()).isEqualTo(CassandraVectorStoreConfig.DEFAULT_TABLE_NAME);
36-
assertThat(props.getContentColumnName()).isEqualTo(CassandraVectorStoreConfig.DEFAULT_CONTENT_COLUMN_NAME);
37-
assertThat(props.getEmbeddingColumnName()).isEqualTo(CassandraVectorStoreConfig.DEFAULT_EMBEDDING_COLUMN_NAME);
35+
assertThat(props.getKeyspace()).isEqualTo(CassandraVectorStore.DEFAULT_KEYSPACE_NAME);
36+
assertThat(props.getTable()).isEqualTo(CassandraVectorStore.DEFAULT_TABLE_NAME);
37+
assertThat(props.getContentColumnName()).isEqualTo(CassandraVectorStore.DEFAULT_CONTENT_COLUMN_NAME);
38+
assertThat(props.getEmbeddingColumnName()).isEqualTo(CassandraVectorStore.DEFAULT_EMBEDDING_COLUMN_NAME);
3839
assertThat(props.getIndexName()).isNull();
39-
assertThat(props.getFixedThreadPoolExecutorSize())
40-
.isEqualTo(CassandraVectorStoreConfig.DEFAULT_ADD_CONCURRENCY);
40+
assertThat(props.getFixedThreadPoolExecutorSize()).isEqualTo(CassandraVectorStore.DEFAULT_ADD_CONCURRENCY);
4141
}
4242

4343
@Test

vector-stores/spring-ai-cassandra-store/src/main/java/org/springframework/ai/vectorstore/cassandra/CassandraVectorStoreConfig.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ public static final class Builder {
413413
private Builder() {
414414
}
415415

416+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
416417
public Builder withCqlSession(CqlSession session) {
417418
Preconditions.checkState(null == this.sessionBuilder,
418419
"Cannot call withContactPoint(..) or withLocalDatacenter(..) and this method");
@@ -421,6 +422,7 @@ public Builder withCqlSession(CqlSession session) {
421422
return this;
422423
}
423424

425+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
424426
public Builder addContactPoint(InetSocketAddress contactPoint) {
425427
Preconditions.checkState(null == this.session, "Cannot call withCqlSession(..) and this method");
426428
if (null == this.sessionBuilder) {
@@ -430,6 +432,7 @@ public Builder addContactPoint(InetSocketAddress contactPoint) {
430432
return this;
431433
}
432434

435+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
433436
public Builder withLocalDatacenter(String localDC) {
434437
Preconditions.checkState(null == this.session, "Cannot call withCqlSession(..) and this method");
435438
if (null == this.sessionBuilder) {
@@ -439,22 +442,26 @@ public Builder withLocalDatacenter(String localDC) {
439442
return this;
440443
}
441444

445+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
442446
public Builder withKeyspaceName(String keyspace) {
443447
this.keyspace = keyspace;
444448
return this;
445449
}
446450

451+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
447452
public Builder withTableName(String table) {
448453
this.table = table;
449454
return this;
450455
}
451456

457+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
452458
public Builder withPartitionKeys(List<SchemaColumn> partitionKeys) {
453459
Preconditions.checkArgument(!partitionKeys.isEmpty());
454460
this.partitionKeys = partitionKeys;
455461
return this;
456462
}
457463

464+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
458465
public Builder withClusteringKeys(List<SchemaColumn> clusteringKeys) {
459466
this.clusteringKeys = clusteringKeys;
460467
return this;
@@ -464,21 +471,25 @@ public Builder withClusteringKeys(List<SchemaColumn> clusteringKeys) {
464471
* defaults (if null) to '&lt;table_name&gt;_&lt;embedding_column_name&gt;_idx'
465472
**/
466473
@Nullable
474+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
467475
public Builder withIndexName(String name) {
468476
this.indexName = name;
469477
return this;
470478
}
471479

480+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
472481
public Builder withContentColumnName(String name) {
473482
this.contentColumnName = name;
474483
return this;
475484
}
476485

486+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
477487
public Builder withEmbeddingColumnName(String name) {
478488
this.embeddingColumnName = name;
479489
return this;
480490
}
481491

492+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
482493
public Builder addMetadataColumns(SchemaColumn... columns) {
483494
Builder builder = this;
484495
for (SchemaColumn f : columns) {
@@ -487,12 +498,14 @@ public Builder addMetadataColumns(SchemaColumn... columns) {
487498
return builder;
488499
}
489500

501+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
490502
public Builder addMetadataColumns(List<SchemaColumn> columns) {
491503
Builder builder = this;
492504
this.metadataColumns.addAll(columns);
493505
return builder;
494506
}
495507

508+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
496509
public Builder addMetadataColumn(SchemaColumn column) {
497510

498511
Preconditions.checkArgument(this.metadataColumns.stream().noneMatch(sc -> sc.name().equals(column.name())),
@@ -502,11 +515,13 @@ public Builder addMetadataColumn(SchemaColumn column) {
502515
return this;
503516
}
504517

518+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
505519
public Builder disallowSchemaChanges() {
506520
this.disallowSchemaChanges = true;
507521
return this;
508522
}
509523

524+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
510525
public Builder returnEmbeddings() {
511526
this.returnEmbeddings = true;
512527
return this;
@@ -518,22 +533,26 @@ public Builder returnEmbeddings() {
518533
* utilize network. For local transformers you probably want a lower value to
519534
* avoid saturation.
520535
**/
536+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
521537
public Builder withFixedThreadPoolExecutorSize(int threads) {
522538
Preconditions.checkArgument(0 < threads);
523539
this.fixedThreadPoolExecutorSize = threads;
524540
return this;
525541
}
526542

543+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
527544
public Builder withDocumentIdTranslator(DocumentIdTranslator documentIdTranslator) {
528545
this.documentIdTranslator = documentIdTranslator;
529546
return this;
530547
}
531548

549+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
532550
public Builder withPrimaryKeyTranslator(PrimaryKeyTranslator primaryKeyTranslator) {
533551
this.primaryKeyTranslator = primaryKeyTranslator;
534552
return this;
535553
}
536554

555+
@Deprecated(since = "1.0.0-M5", forRemoval = true)
537556
public CassandraVectorStoreConfig build() {
538557
if (null == this.indexName) {
539558
this.indexName = String.format("%s_%s_%s", this.table, this.embeddingColumnName, DEFAULT_INDEX_SUFFIX);

0 commit comments

Comments
 (0)