A modern Spring Boot microservice demonstrating cloud-native application development with Kotlin, JPA, and comprehensive multi-platform deployment strategies.
- Spring Boot 3.5.6 with Java 21 - Latest LTS foundation
- Kotlin 2.2.20 - Modern, expressive language
- Multi-module architecture - Domain and web separation
- Cloud Native Buildpacks - Container images without Dockerfiles
- Dual build support - Both Maven and Gradle
- Multi-platform deployments - AWS, Azure, Google Cloud, Tanzu Platform
- Production-ready - Actuator, metrics, health checks
- Java 21 (LTS) - Required for Spring Boot 3.5.6
- Docker - For database and container builds
- Git - For version control
Optional but recommended:
- HTTPie - API testing
- jq - JSON processing
# 1. Clone and build
git clone https://github.com/pacphi/spring-boot-with-kotlin-and-jpa-example.git
cd spring-boot-with-kotlin-and-jpa-example
./mvnw package # or ./gradlew build
# 2. Start database
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=geo_data postgres:15
# 3. Run application
./mvnw -pl cities-web spring-boot:run -Dspring.profiles.active=postgres,seededVerify it works:
curl http://localhost:8080/cities | jq .This application demonstrates domain-driven design with clear separation:
- cities-domain - Business logic, entities, and repositories
- cities-web - REST API, controllers, and web configuration
Key Features:
- RESTful API with HATEOAS support
- PostgreSQL with Flyway migrations
- Comprehensive monitoring with Actuator
- Multi-environment configuration profiles
- Container-first deployment approach
→ See full architecture details
Choose your build tool:
Quick build commands:
# Maven
./mvnw package
# Gradle
./gradlew buildThis application showcases deployment strategies across major cloud platforms:
- Local Development - Docker Compose, embedded database options
- Docker - Cloud Native Buildpacks (no Dockerfile needed!)
- Minikube - Local Kubernetes development with 2025 features (AI workloads, enhanced security)
- KOPS - Production Kubernetes on AWS with full infrastructure management
- Juju - Model-driven operations and multi-cloud application management
- AWS EKS - Latest Kubernetes 1.33+, EKS Automatic, advanced security
- Azure AKS - AKS Automatic, Azure Linux migration, AI/ML integration
- Google Cloud GKE - AI-powered features, TPU support, latest performance improvements
- Tanzu Platform - Cloud Foundry v10.0, simplified developer experience
Each deployment guide includes:
- 2025 platform updates and new features
- Step-by-step instructions with code examples
- Security best practices and compliance
- CI/CD pipeline examples (GitHub Actions, Jenkins, etc.)
- Cost optimization strategies
- Monitoring and troubleshooting guides
| Method | Path | Description |
|---|---|---|
GET |
/cities |
List all cities |
GET |
/cities/{id} |
Get city by ID |
POST |
/cities |
Create new city |
PUT |
/cities/{id} |
Update existing city |
DELETE |
/cities/{id} |
Delete city |
# List cities
curl http://localhost:8080/cities | jq .
# Create city
curl -X POST http://localhost:8080/cities \
-H "Content-Type: application/json" \
-d '{
"id": "NYC",
"name": "New York City",
"description": "The Big Apple",
"location": {"latitude": 40.7128, "longitude": -74.0060}
}'
# Update city
curl -X PUT http://localhost:8080/cities/NYC \
-H "Content-Type: application/json" \
-d '{"description": "Updated description"}'Spring Boot Actuator provides production-ready monitoring:
/actuator/health- Application health status/actuator/metrics- Application metrics/actuator/prometheus- Prometheus-format metrics/actuator/info- Application information
→ See complete API documentation
├── cities-domain/ # Business logic and entities
│ ├── src/main/kotlin/ # Domain services and repositories
│ └── src/test/kotlin/ # Domain tests
├── cities-web/ # REST API and web layer
│ ├── src/main/kotlin/ # Controllers and configuration
│ └── src/test/kotlin/ # Integration tests
├── docs/ # Documentation
└── specs/ # Deployment configurations
├── docker/ # Docker Compose files
└── k8s/ # Kubernetes manifests
- Backend: Spring Boot 3.5.6, Kotlin 2.2.20, Java 21
- Database: PostgreSQL 15+ with Flyway migrations
- Containerization: Cloud Native Buildpacks, Docker
- Monitoring: Spring Actuator, Micrometer, Prometheus
- Testing: JUnit 5, MockK, TestContainers
- Architecture - Application design, patterns, and structure
- Build - Maven/Gradle builds, CI/CD, container creation
- Run - Local development, configuration, API testing
- AWS Deployment - EKS, ECR, RDS, latest 2025 features
- Azure Deployment - AKS, ACR, PostgreSQL, AKS Automatic
- Google Cloud Deployment - GKE, Artifact Registry, Cloud SQL, AI features
- Tanzu Platform Deployment - Cloud Foundry v10.0, service bindings
- Minikube - Local Kubernetes development, AI workload support, security hardening
- KOPS - Production-grade Kubernetes on AWS, auto-scaling, monitoring
- Juju - Model-driven operations, charms, multi-cloud management
- Appendices - Tools, commands, troubleshooting, reference
- Tool Installation - All required tools and CLIs
- Command Reference - Maven, Gradle, Docker, kubectl commands
- Configuration Templates - Ready-to-use config files
- Troubleshooting - Common issues and solutions
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project demonstrates the latest cloud-native development practices:
- ✅ Java 21 LTS - Latest long-term support release
- ✅ Spring Boot 3.5.6 - Modern Spring ecosystem
- ✅ Cloud Native Buildpacks - Dockerfile-free containerization
- ✅ Multi-platform deployment - AWS, Azure, Google Cloud, Tanzu Platform
- ✅ Advanced Kubernetes - Latest features across all major cloud providers
- ✅ AI/ML Ready - Supports latest cloud AI/ML integrations
- ✅ Security Best Practices - Pod Security Standards, RBAC, Zero Trust
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
- Built upon ideas from the codecentric blog article
- Demonstrates cloud-native patterns and multi-platform deployment strategies
- Updated for 2025 with latest platform features and best practices