Skip to content

Commit 7647980

Browse files
committed
Create spring-boot-cassandra module
1 parent 58ee90c commit 7647980

File tree

56 files changed

+183
-142
lines changed

Some content is hidden

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

56 files changed

+183
-142
lines changed

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ include "spring-boot-project:spring-boot-artemis"
5050
include "spring-boot-project:spring-boot-autoconfigure"
5151
include "spring-boot-project:spring-boot-autoconfigure-all"
5252
include "spring-boot-project:spring-boot-batch"
53+
include "spring-boot-project:spring-boot-cassandra"
5354
include "spring-boot-project:spring-boot-couchbase"
5455
include "spring-boot-project:spring-boot-data-jpa"
5556
include "spring-boot-project:spring-boot-dependencies"

spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies {
2020
optional(project(":spring-boot-project:spring-boot-activemq"))
2121
optional(project(":spring-boot-project:spring-boot-amqp"))
2222
optional(project(":spring-boot-project:spring-boot-artemis"))
23+
optional(project(":spring-boot-project:spring-boot-cassandra"))
2324
optional(project(":spring-boot-project:spring-boot-couchbase"))
2425
optional(project(":spring-boot-project:spring-boot-data-jpa"))
2526
optional(project(":spring-boot-project:spring-boot-elasticsearch"))

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cassandra/CassandraHealthContributorAutoConfiguration.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@
2323
import org.springframework.boot.actuate.cassandra.CassandraDriverHealthIndicator;
2424
import org.springframework.boot.autoconfigure.AutoConfiguration;
2525
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
26-
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
2726
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2827
import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
2928
import org.springframework.context.annotation.Import;
@@ -36,8 +35,9 @@
3635
* @author Stephane Nicoll
3736
* @since 2.1.0
3837
*/
39-
@AutoConfiguration(after = { CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class,
40-
CassandraReactiveHealthContributorAutoConfiguration.class })
38+
@AutoConfiguration(
39+
after = { CassandraDataAutoConfiguration.class, CassandraReactiveHealthContributorAutoConfiguration.class },
40+
afterName = "org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration")
4141
@ConditionalOnClass(CqlSession.class)
4242
@ConditionalOnEnabledHealthIndicator("cassandra")
4343
@Import(CassandraDriverConfiguration.class)

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebEndpointsAutoConfigurationIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.springframework.boot.actuate.health.HealthEndpointWebExtension;
2525
import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension;
2626
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
27-
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
2827
import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
2928
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
3029
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
@@ -36,6 +35,7 @@
3635
import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration;
3736
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
3837
import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration;
38+
import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration;
3939
import org.springframework.boot.context.annotation.UserConfigurations;
4040
import org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration;
4141
import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration;

spring-boot-project/spring-boot-autoconfigure-all/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ dependencies {
4343

4444
optional(project(":spring-boot-project:spring-boot-activemq"))
4545
optional(project(":spring-boot-project:spring-boot-artemis"))
46+
optional(project(":spring-boot-project:spring-boot-cassandra"))
4647
optional(project(":spring-boot-project:spring-boot-couchbase"))
4748
optional(project(":spring-boot-project:spring-boot-data-jpa"))
4849
optional(project(":spring-boot-project:spring-boot-elasticsearch"))

spring-boot-project/spring-boot-autoconfigure-all/src/dockerTest/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfigurationIntegrationTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@
2626
import org.springframework.beans.factory.config.BeanPostProcessor;
2727
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
2828
import org.springframework.boot.autoconfigure.AutoConfigurations;
29+
import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration;
2930
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
3031
import org.springframework.boot.testsupport.container.TestImage;
3132
import org.springframework.context.annotation.Bean;

spring-boot-project/spring-boot-autoconfigure-all/src/dockerTest/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfigurationWithPasswordAuthenticationIntegrationTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@
3737

3838
import org.springframework.beans.factory.BeanCreationException;
3939
import org.springframework.boot.autoconfigure.AutoConfigurations;
40+
import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration;
4041
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
4142
import org.springframework.boot.testsupport.container.TestImage;
4243
import org.springframework.util.StreamUtils;

spring-boot-project/spring-boot-autoconfigure-all/src/dockerTest/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationIntegrationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,8 +26,8 @@
2626
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
2727
import org.springframework.boot.autoconfigure.AutoConfigurationPackages;
2828
import org.springframework.boot.autoconfigure.AutoConfigurations;
29-
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
3029
import org.springframework.boot.autoconfigure.data.cassandra.city.City;
30+
import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration;
3131
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
3232
import org.springframework.boot.testsupport.container.TestImage;
3333
import org.springframework.context.annotation.Bean;

spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.springframework.boot.autoconfigure.AutoConfiguration;
2626
import org.springframework.boot.autoconfigure.AutoConfigurationPackages;
2727
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
28-
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
2928
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
3029
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3130
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -60,7 +59,7 @@
6059
* @author Christoph Strobl
6160
* @since 1.3.0
6261
*/
63-
@AutoConfiguration(after = CassandraAutoConfiguration.class)
62+
@AutoConfiguration(afterName = "org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration")
6463
@ConditionalOnClass({ CqlSession.class, CassandraAdminOperations.class })
6564
@ConditionalOnBean(CqlSession.class)
6665
public class CassandraDataAutoConfiguration {

spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json

-61
Original file line numberDiff line numberDiff line change
@@ -13,56 +13,6 @@
1313
"description": "Whether subclass-based (CGLIB) proxies are to be created (true), as opposed to standard Java interface-based proxies (false).",
1414
"defaultValue": true
1515
},
16-
{
17-
"name": "spring.cassandra.compression",
18-
"defaultValue": "none"
19-
},
20-
{
21-
"name": "spring.cassandra.connection.connect-timeout",
22-
"defaultValue": "5s"
23-
},
24-
{
25-
"name": "spring.cassandra.connection.init-query-timeout",
26-
"defaultValue": "5s"
27-
},
28-
{
29-
"name": "spring.cassandra.contact-points",
30-
"defaultValue": [
31-
"127.0.0.1:9042"
32-
]
33-
},
34-
{
35-
"name": "spring.cassandra.controlconnection.timeout",
36-
"defaultValue": "5s"
37-
},
38-
{
39-
"name": "spring.cassandra.pool.heartbeat-interval",
40-
"defaultValue": "30s"
41-
},
42-
{
43-
"name": "spring.cassandra.pool.idle-timeout",
44-
"defaultValue": "5s"
45-
},
46-
{
47-
"name": "spring.cassandra.request.page-size",
48-
"defaultValue": 5000
49-
},
50-
{
51-
"name": "spring.cassandra.request.throttler.type",
52-
"defaultValue": "none"
53-
},
54-
{
55-
"name": "spring.cassandra.request.timeout",
56-
"defaultValue": "2s"
57-
},
58-
{
59-
"name": "spring.cassandra.ssl",
60-
"type": "java.lang.Boolean",
61-
"deprecation": {
62-
"replacement": "spring.cassandra.ssl.enabled",
63-
"level": "error"
64-
}
65-
},
6616
{
6717
"name": "spring.dao.exceptiontranslation.enabled",
6818
"type": "java.lang.Boolean",
@@ -1485,17 +1435,6 @@
14851435
}
14861436
]
14871437
},
1488-
{
1489-
"name": "spring.cassandra.schema-action",
1490-
"providers": [
1491-
{
1492-
"name": "handle-as",
1493-
"parameters": {
1494-
"target": "org.springframework.data.cassandra.config.SchemaAction"
1495-
}
1496-
}
1497-
]
1498-
},
14991438
{
15001439
"name": "spring.data.mongodb.field-naming-strategy",
15011440
"providers": [

spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
org.springframework.boot.autoconfigure.aop.AopAutoConfiguration
22
org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration
3-
org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration
43
org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration
54
org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration
65
org.springframework.boot.autoconfigure.data.cassandra.CassandraReactiveDataAutoConfiguration

spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
import org.junit.jupiter.api.Test;
2323

2424
import org.springframework.boot.autoconfigure.AutoConfigurations;
25-
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
2625
import org.springframework.boot.autoconfigure.data.cassandra.city.City;
2726
import org.springframework.boot.autoconfigure.domain.EntityScan;
27+
import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration;
2828
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
2929
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
3030
import org.springframework.context.annotation.Bean;

spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.boot.autoconfigure.AutoConfigurations;
22-
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
2322
import org.springframework.boot.autoconfigure.data.cassandra.city.City;
2423
import org.springframework.boot.autoconfigure.domain.EntityScan;
24+
import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration;
2525
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
2626
import org.springframework.context.annotation.Configuration;
2727
import org.springframework.data.cassandra.core.ReactiveCassandraTemplate;

spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveRepositoriesAutoConfigurationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,12 +21,12 @@
2121

2222
import org.springframework.boot.autoconfigure.AutoConfigurations;
2323
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
24-
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
2524
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
2625
import org.springframework.boot.autoconfigure.data.alt.cassandra.ReactiveCityCassandraRepository;
2726
import org.springframework.boot.autoconfigure.data.cassandra.city.City;
2827
import org.springframework.boot.autoconfigure.data.cassandra.city.ReactiveCityRepository;
2928
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
29+
import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration;
3030
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
3131
import org.springframework.context.ApplicationContext;
3232
import org.springframework.context.annotation.Configuration;

spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,12 +21,12 @@
2121

2222
import org.springframework.boot.autoconfigure.AutoConfigurations;
2323
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
24-
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
2524
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
2625
import org.springframework.boot.autoconfigure.data.alt.cassandra.CityCassandraRepository;
2726
import org.springframework.boot.autoconfigure.data.cassandra.city.City;
2827
import org.springframework.boot.autoconfigure.data.cassandra.city.CityRepository;
2928
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
29+
import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration;
3030
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
3131
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
3232
import org.springframework.context.annotation.Configuration;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
plugins {
2+
id "java-library"
3+
id "org.springframework.boot.auto-configuration"
4+
id "org.springframework.boot.configuration-properties"
5+
id "org.springframework.boot.deployed"
6+
id "org.springframework.boot.optional-dependencies"
7+
}
8+
9+
description = "Spring Boot Cassandra"
10+
11+
dependencies {
12+
api(project(":spring-boot-project:spring-boot"))
13+
api("org.apache.cassandra:java-driver-core")
14+
15+
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
16+
17+
testImplementation(project(":spring-boot-project:spring-boot-test"))
18+
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
19+
20+
testRuntimeOnly("ch.qos.logback:logback-classic")
21+
}
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.cassandra;
17+
package org.springframework.boot.cassandra.autoconfigure;
1818

1919
import java.io.IOException;
2020
import java.time.Duration;
@@ -39,14 +39,14 @@
3939
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
4040
import org.springframework.boot.autoconfigure.AutoConfiguration;
4141
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
42-
import org.springframework.boot.autoconfigure.cassandra.CassandraProperties.Connection;
43-
import org.springframework.boot.autoconfigure.cassandra.CassandraProperties.Controlconnection;
44-
import org.springframework.boot.autoconfigure.cassandra.CassandraProperties.Request;
45-
import org.springframework.boot.autoconfigure.cassandra.CassandraProperties.Ssl;
46-
import org.springframework.boot.autoconfigure.cassandra.CassandraProperties.Throttler;
47-
import org.springframework.boot.autoconfigure.cassandra.CassandraProperties.ThrottlerType;
4842
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
4943
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
44+
import org.springframework.boot.cassandra.autoconfigure.CassandraProperties.Connection;
45+
import org.springframework.boot.cassandra.autoconfigure.CassandraProperties.Controlconnection;
46+
import org.springframework.boot.cassandra.autoconfigure.CassandraProperties.Request;
47+
import org.springframework.boot.cassandra.autoconfigure.CassandraProperties.Ssl;
48+
import org.springframework.boot.cassandra.autoconfigure.CassandraProperties.Throttler;
49+
import org.springframework.boot.cassandra.autoconfigure.CassandraProperties.ThrottlerType;
5050
import org.springframework.boot.context.properties.EnableConfigurationProperties;
5151
import org.springframework.boot.context.properties.PropertyMapper;
5252
import org.springframework.boot.ssl.SslBundle;
@@ -72,7 +72,7 @@
7272
* @author Andy Wilkinson
7373
* @author Phillip Webb
7474
* @author Scott Frederick
75-
* @since 1.3.0
75+
* @since 4.0.0
7676
*/
7777
@AutoConfiguration
7878
@ConditionalOnClass(CqlSession.class)
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.cassandra;
17+
package org.springframework.boot.cassandra.autoconfigure;
1818

1919
import java.util.List;
2020

@@ -27,7 +27,7 @@
2727
* @author Moritz Halbritter
2828
* @author Andy Wilkinson
2929
* @author Phillip Webb
30-
* @since 3.1.0
30+
* @since 4.0.0
3131
*/
3232
public interface CassandraConnectionDetails extends ConnectionDetails {
3333

Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.cassandra;
17+
package org.springframework.boot.cassandra.autoconfigure;
1818

1919
import java.time.Duration;
2020
import java.util.List;
@@ -32,7 +32,7 @@
3232
* @author Mark Paluch
3333
* @author Stephane Nicoll
3434
* @author Scott Frederick
35-
* @since 1.3.0
35+
* @since 4.0.0
3636
*/
3737
@ConfigurationProperties("spring.cassandra")
3838
public class CassandraProperties {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.cassandra;
17+
package org.springframework.boot.cassandra.autoconfigure;
1818

1919
import com.datastax.oss.driver.api.core.CqlSession;
2020
import com.datastax.oss.driver.api.core.CqlSessionBuilder;
@@ -25,7 +25,7 @@
2525
* auto-configuration.
2626
*
2727
* @author Stephane Nicoll
28-
* @since 2.3.0
28+
* @since 4.0.0
2929
*/
3030
@FunctionalInterface
3131
public interface CqlSessionBuilderCustomizer {

0 commit comments

Comments
 (0)