← Prompts
Reference / Understand Copilot Instructions Collection
Step-by-step guide for converting Spring Boot JPA applications to use Azure Cosmos DB with Spring Data Cosmos
Step-by-step guide for converting Spring Boot JPA applications to use Azure Cosmos DB with Spring Data Cosmos
# Convert Spring JPA project to Spring Data Cosmos This generalized guide applies to any JPA to Spring Data Cosmos DB conversion project. ## High-level plan 1. Swap build dependencies (remove JPA, add Cosmos + Identity). 2. Add `cosmos` profile and properties. 3. Add Cosmos config with proper Azure identity authentication. 4. Transform entities (ids → `String`, add `@Container` and `@PartitionKey`, remove JPA mappings, adjust relationships). 5. Convert repositories (`JpaRepository` → `CosmosRepository`). 6. **Create service layer** for relationship management and template compatibility. 7. **CRITICAL**: Update ALL test files to work with String IDs and Cosmos repositories. 8. Seed data via `CommandLineRunner`. 9. **CRITICAL**: Test runtime functionality and fix template compatibility issues. ## Step-by-step ### Step 1 — Build dependencies - **Maven** (`pom.xml`): - Remove dependency `spring-boot-starter-data-jpa` - Remove database-specific dependencies (H2, MySQL, PostgreSQL) unless needed elsewhere - Add `com.azure:azure-spring-data-cosmos:5.17.0` (or latest compatible version) - Add `com.azure:azure-identity:1.15.4` (required for DefaultAzureCredential)
Sign in to view the full prompt.
Sign InClassification
Reference Documentation, cheatsheets, setup guides
Reference Understand
Explain or analyzeScope Project
This codebase Manual Manually placed / Persistent