MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Convert-Cassandra-To-Spring-Data-Cosmos

Convert-Cassandra-To-Spring-Data-Cosmos是一款data方向的AI技能,核心价值是Step-by-step guide for converting Spring Boot Cassandra applications to use Azure Cosmos DB with Spring Data Cosmos,可用于解决开发者在data领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Step-by-step guide for converting Spring Boot Cassandra applications to use Azure Cosmos DB with Spring Data Cosmos

Last verified on: 2026-05-30
mkdir -p ./skills/convert-cassandra-to-spring-data-cosmos && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/convert-cassandra-to-spring-data-cosmos/SKILL.md -o ./skills/convert-cassandra-to-spring-data-cosmos/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# Comprehensive Guide: Converting Spring Boot Cassandra Applications to use Azure Cosmos DB with Spring Data Cosmos (spring-data-cosmos)


Applicability


This guide applies to:

- ✅ Spring Boot 2.x - 3.x applications (both reactive and non-reactive)

- ✅ Maven and Gradle-based projects

- ✅ Applications using Spring Data Cassandra, Cassandra DAOs, or DataStax drivers

- ✅ Projects with or without Lombok

- ✅ UUID-based or String-based entity identifiers

- ✅ Both synchronous and reactive (Spring WebFlux) applications


This guide does NOT cover:

- ❌ Non-Spring frameworks (Jakarta EE, Micronaut, Quarkus, plain Java)

- ❌ Complex Cassandra features (materialized views, UDTs, counters, custom types)

- ❌ Bulk data migration (code conversion only - data must be migrated separately)

- ❌ Cassandra-specific features like lightweight transactions (LWT) or batch operations across partitions


Overview


This guide provides step-by-step instructions for converting reactive Spring Boot applications from Apache Cassandra to Azure Cosmos DB using Spring Data Cosmos. It covers all major issues encountered and their solutions, based on real-world conversion experience.


Prerequisites


- Java 11 or higher (Java 17+ required for Spring Boot 3.x)

- Azure CLI installed and authenticated (`az login`) for local development

- Azure Cosmos DB account created in Azure Portal

- Maven 3.6+ or Gradle 6+ (depending on your project)

- For Gradle projects with Spring Boot 3.x: Ensure JAVA_HOME environment variable points to Java 17+

- Basic understanding of your application's data model and query patterns


Database Setup for Azure Cosmos DB


**CRITICAL**: Before running your application, ensure the database exists in your Cosmos DB account.


Option 1: Manual Database Creation (Recommended for first run)

1. Go to Azure Portal → Your Cosmos DB account

2. Navigate to "Data Explorer"

3. Click "New Database"

4. Enter the database name matching your application configuration (check `application.properties` or `application.yml` for the configured database name)

5. Choose throughput settings (Manual or Autoscale based on your needs)

- Start with Manual 400 RU/s for development/testing

- Use Autoscale for production workloads with variable traffic

6. Click OK


Option 2: Automatic Creation

Spring Data Cosmos can auto-create the database on first connection, but this requires:

- Proper RBAC permissions (Cosmos DB Built-in Data Contributor role)

- May fail if permissions are insufficient


Container (Collection) Creation

Containers will be auto-created by Spring Data Cosmos when the application starts, using the `@Container` annotation settings from your entities. No manual container creation is needed unless you want to configure specific throughput or indexing policies.


Authentication with Azure Cosmos DB


Using DefaultAzureCredential (Recommended)

The `DefaultAzureCredential` authentication method is the recommended approach for both development and production:


**How it works**:

1. Tries multiple credential sources in order:

- Environment variables

- Workload Identity (for AKS)

- Managed Identity (for Azure VMs/App Service)

- Azure CLI (`az login`)

- Azure PowerShell

- Azure Developer CLI


**Setup for local development**:

bash
# Login via Azure CLI
az login

# The application will automatically use your CLI credentials

**Configuration** (no key required):

java
@Bean
public CosmosClientBuilder getCosmosClientBuilder() {
    return new CosmosClientBuilder()
        .endpoint(uri)
        .credential(new DefaultAzureCredentialBuilder().build());
}

**Properties file** (application-cosmos.properties or application.properties):

properties
azure.cosmos.uri=https://<your-cosmos-account-name>.documents.azure.com:443/
azure.cosmos.database=<your-database-name>
# No key property needed when using DefaultAzureCredential
azure.cosmos.populate-query-metrics=false

**Note**: Replace `<your-cosmos-account-name>` an

🎯 Best For

  • UI designers
  • Product designers
  • Claude users
  • GitHub Copilot users
  • Data professionals

💡 Use Cases

  • Generating component mockups
  • Creating design system tokens
  • Data pipeline auditing
  • Query optimization

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Convert-Cassandra-To-Spring-Data-Cosmos to Your Work

    Provide context for your task — paste source material, describe your audience, or share existing work to guide the AI.

  4. 4

    Review and Refine

    Edit the AI output for accuracy, tone, and completeness. Add human insight where the AI lacks context.

❓ Frequently Asked Questions

Does this work with Figma?

Some design skills integrate with Figma plugins. Check the Works With section for supported tools.

How do I install Convert-Cassandra-To-Spring-Data-Cosmos?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/convert-cassandra-to-spring-data-cosmos/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping usability testing

AI-generated designs should be validated with real users before development.

Ignoring data quality

AI analysis inherits all data quality issues — profile your data first.

🔗 Related Skills