Seamlessly integrate Azure App Configuration with Spring Boot for dynamic configuration management - A production-ready Maven project demonstrating cloud-native configuration patterns with Azure services.
- Overview
- Features
- Prerequisites
- Quick Start
- Project Structure
- API Endpoints
- Configuration
- Running the Application
- Testing
- Troubleshooting
- Best Practices
- Contributing
- License
This Spring Boot application demonstrates enterprise-grade integration with Azure App Configuration, enabling centralized configuration management, dynamic updates, and feature flag control without application restarts. Perfect for microservices architectures and cloud-native applications.
Centralized Configuration - Manage all application settings from Azure
Dynamic Updates - Refresh configurations without redeployment
Feature Flags - Control feature rollouts dynamically
Secure Secrets - Integration with Azure Key Vault
Environment Isolation - Separate configs for dev, staging, production
- Spring Boot 2.7.15 with Maven build system
- Azure App Configuration integration via Spring Cloud Azure
- Bootstrap configuration for early-stage property loading
- RESTful API endpoints for configuration testing
- Managed Identity support for Azure authentication
- Development-ready with debug endpoints
- Production-ready packaging and deployment
Before running this application, ensure you have:
- Java Development Kit (JDK) 11 or higher (Download)
- Apache Maven 3.6+ (Download)
- Azure Account with App Configuration instance (Create Free Account)
- Git for version control (Download)
java -version # Should show Java 11 or higher
mvn -version # Should show Maven 3.6 or highergit clone https://github.com/yourusername/spring-boot-azure-app-configuration.git
cd spring-boot-azure-app-configurationEdit src/main/resources/bootstrap.yml and add your Azure App Configuration connection string:
spring:
cloud:
azure:
appconfiguration:
stores:
- connection-string: "Endpoint=https://your-config-store.azconfig.io;Id=XXXX;Secret=XXXX"mvn clean installmvn spring-boot:runThe application will start on http://localhost:8080
spring-boot-azure-app-configuration/
βββ src/
β βββ main/
β β βββ java/com/example/nftclubcoinapp/
β β β βββ NftClubcoinAppApplication.java # Main application class
β β β βββ controller/
β β β β βββ ConfigController.java # Configuration endpoints
β β β β βββ AuthController.java # Authentication endpoints
β β β β βββ UserController.java # User management
β β β β βββ ... # Other controllers
β β β βββ util/
β β β βββ StaticResponseUtil.java # Utility classes
β β βββ resources/
β β βββ bootstrap.yml # Azure configuration
β βββ test/ # Test files
βββ target/ # Maven build output
βββ pom.xml # Maven dependencies
βββ MAVEN_README.md # Technical documentation
βββ README.md # This file
Once running, the following endpoints are available:
| Endpoint | Method | Description | Example Response |
|---|---|---|---|
/config |
GET | Get single configuration value | "Value from Azure App Configuration: myValue" |
/config/json |
GET | Get all configurations as JSON | {"name1": "value1", "name2": "value2"} |
/env |
GET | Get environment property | "Environment property 'name1': value1" |
/debug |
GET | Debug Azure App Configuration | Detailed configuration sources |
# Test the JSON configuration endpoint
curl http://localhost:8080/config/jsonExpected Response:
{
"name1": "value-from-azure",
"name2": "another-value",
"source": "Azure App Configuration"
}- Create App Configuration Store in Azure Portal
- Add Configuration Keys:
- Key:
name1, Value:your-first-value - Key:
name2, Value:your-second-value
- Key:
- Get Connection String from Azure Portal β Access Keys
- Update
bootstrap.ymlwith your connection string
spring:
cloud:
azure:
appconfiguration:
stores:
- connection-string: ${AZURE_APPCONFIG_CONNECTION_STRING}
credential:
managed-identity-enabled: false # Disable if not using managed identityFor production deployments, use environment variables:
# Windows PowerShell
$env:AZURE_APPCONFIG_CONNECTION_STRING="Endpoint=https://..."
# Linux/Mac
export AZURE_APPCONFIG_CONNECTION_STRING="Endpoint=https://..."mvn spring-boot:run# Build the JAR
mvn clean package
# Run the JAR
java -jar target/nftclubcoin-app-0.0.1-SNAPSHOT.jarIntelliJ IDEA:
- Open the project (File β Open β Select
pom.xml) - Right-click on
NftClubcoinAppApplication.java - Select "Run 'NftClubcoinAppApplication'"
VS Code:
- Install "Extension Pack for Java"
- Open the project folder
- Press
F5to run
Eclipse:
- Import β Existing Maven Project
- Right-click project β Run As β Spring Boot App
mvn testmvn clean install -DskipTests# Test configuration endpoint
curl http://localhost:8080/config
# Test JSON endpoint (MAIN ENDPOINT)
curl http://localhost:8080/config/json
# Test environment endpoint
curl http://localhost:8080/env
# Debug configuration
curl http://localhost:8080/debugCause: The application is trying to use Managed Identity authentication but the required environment variables are not set.
Solution 1 - Disable Managed Identity (Recommended for local development):
Add to src/main/resources/bootstrap.yml:
spring:
cloud:
azure:
credential:
managed-identity-enabled: falseSolution 2 - Provide Service Principal Credentials:
# Windows PowerShell
$env:AZURE_CLIENT_ID="your-client-id"
$env:AZURE_CLIENT_SECRET="your-client-secret"
$env:AZURE_TENANT_ID="your-tenant-id"
# Linux/Mac
export AZURE_CLIENT_ID="your-client-id"
export AZURE_CLIENT_SECRET="your-client-secret"
export AZURE_TENANT_ID="your-tenant-id"Solutions:
- Verify connection string is correct in
bootstrap.yml - Check network connectivity to Azure
- Ensure keys exist in Azure App Configuration
- Check Azure App Configuration access permissions
Check:
- Java version:
java -version(Must be 11+) - Maven version:
mvn -version(Must be 3.6+) - Port 8080 is not in use:
netstat -ano | findstr :8080 - Build the project:
mvn clean install
- β Never commit connection strings to version control
- β Use environment variables for sensitive data
- β Use Managed Identity in Azure deployments
- β Integrate with Azure Key Vault for secrets
- β Enable caching for configuration values
- β Use refresh strategies for dynamic updates
- β Monitor Azure App Configuration requests
- β Use different App Configuration stores for each environment
- β Implement proper error handling
- β Log configuration loading events
- β Test with mock configurations locally
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Spring Boot Documentation
- Azure App Configuration Documentation
- Spring Cloud Azure Documentation
- Maven Documentation
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: dilsecodie@gmail.com
Built with β€οΈ using Spring Boot and Azure
Last Updated: December 2025
spring boot azure, azure app configuration, spring cloud azure, java configuration management, azure integration, microservices configuration, cloud native java, spring boot maven, azure spring boot example, centralized configuration, feature flags azure, azure key vault integration