- Replies:
- 0
- Words:
- 18967

application.yml
files. We’ll cover settings for both development and production environments. For production, we’ll show how to pull values from a Kubernetes ConfigMap.url
: MinIO server endpointaccessKey
: your MinIO username or access IDsecretKey
: your MinIO password or secret keyapplication-dev.yml
:
minio:
url: http://localhost:9000
accessKey: minioadmin
secretKey: minioadmin123
Now your app knows how to connect to MinIO during development!
minio-config
. Here’s the YAML:
apiVersion:v1
kind:ConfigMap
metadata:
name:minio-config
namespace:your-namespace
data:
urlMinIO:http://minio-service:9000
accesskey:your-access-key
secretkey:your-secret-key
This ConfigMap holds the MinIO settings you’ll inject into your Spring Boot app.
In your deployment YAML, pass the values as environment variables to your app container:
containers:
- name: your-app
image: your-image
env:
- name: MINIO_URL
valueFrom:
configMapKeyRef:
name: minio-config
key: urlMinIO
- name: MINIO_ACCESS_KEY
valueFrom:
configMapKeyRef:
name: minio-config
key: accesskey
- name: MINIO_SECRET_KEY
valueFrom:
configMapKeyRef:
name: minio-config
key: secretkey
This will make the MinIO details available to Spring Boot as environment variables.
minio:
url: ${MINIO_URL}
accessKey: ${MINIO_ACCESS_KEY}
secretKey: ${MINIO_SECRET_KEY}
Spring Boot will automatically replace the placeholders with the values from the environment.
application-dev.yml
→ used during local developmentapplication-prod.yml
→ used in production (e.g., in Kubernetes)SPRING_PROFILES_ACTIVE
environment variable.SPRING_PROFILES_ACTIVE=dev
For Kubernetes:
env:
name: SPRING_PROFILES_ACTIVE
value: prod
Each profile loads its own settings, keeping dev and prod cleanly separated.
image quote pre code