English | 한국어
A comprehensive set of examples for Apache Cassandra and Spring Data Cassandra (Spring Boot 4.x).
flowchart TD
Entity["@Table Entity"]
Repo["CassandraRepository /<br/>CoroutineCrudRepository"]
Template["CassandraTemplate /<br/>CassandraOperations"]
Reactive["Reactive / Coroutine APIs"]
Cassandra[("Apache Cassandra")]
Entity --> Repo
Entity --> Template
Repo --> Cassandra
Template --> Cassandra
Reactive --> Repo
Reactive --> Template
classDef entityStyle fill:#F57F17,stroke:#E65100,color:#000000
classDef repoStyle fill:#E0F7FA,stroke:#80DEEA,color:#00838F
classDef templateStyle fill:#E0F2F1,stroke:#80CBC4,color:#00695C
classDef reactiveStyle fill:#F3E5F5,stroke:#CE93D8,color:#6A1B9A
classDef dbStyle fill:#FFF3E0,stroke:#FFCC80,color:#E65100
class Entity entityStyle
class Repo repoStyle
class Template templateStyle
class Reactive reactiveStyle
class Cassandra dbStyle
Provides the same examples as the Spring Boot 3 demo (
spring-boot3/cassandra-demo), adapted to the Spring Boot 4.x API.
| Example File | Description |
|---|---|
BasicUserRepositoryTest.kt |
Basic Repository usage |
CassandraOperationsTest.kt |
Running queries with CassandraOperations |
CoroutineCassandraOperationsTest.kt |
Coroutines-based async queries |
| Example File | Description |
|---|---|
PersonRepositoryTest.kt |
Defining a Repository with Kotlin DSL |
TemplateTest.kt |
Using CassandraTemplate |
| Example File | Description |
|---|---|
ReactivePersonRepositoryTest.kt |
Reactive Repository |
CoroutinePersonRepositoryTest.kt |
Coroutines Repository |
| Example File | Description |
|---|---|
AuditingTest.kt |
@CreatedBy, @LastModifiedBy support |
@Table
data class User(
@PrimaryKey val id: UUID = UUID.randomUUID(),
val name: String,
val email: String,
)interface UserRepository : CassandraRepository<User, UUID> {
fun findByEmail(email: String): User?
}interface CoroutinePersonRepository : CoroutineCrudRepository<Person, UUID> {
suspend fun findByLastName(lastName: String): Flow<Person>
}# Start Cassandra via Docker
docker run -d --name cassandra -p 9042:9042 cassandra:4
# Run all examples
./gradlew :bluetape4k-spring-boot4-cassandra-demo:test