Spring Boot "Could not resolve placeholder X in value" in CI
Spring tried to inject a placeholder like ${app.api-key} and found no matching property in any source. In CI this usually means an env var or secret that exists locally was never provided to the runner.
What this error means
Startup fails with "java.lang.IllegalArgumentException: Could not resolve placeholder 'app.api-key' in value '${app.api-key}'".
java.lang.IllegalArgumentException: Could not resolve placeholder 'app.api-key' in
value "${app.api-key}"Common causes
A required env-backed property is unset in CI
The property is normally supplied by an environment variable or secret that the CI step never exports.
A property key typo or missing profile file
The key is misspelled, or the application-ci.properties that would define it is not on the classpath.
How to fix it
Provide the property via env in CI
Set the env var that maps to the property (relaxed binding: APP_API_KEY -> app.api-key).
env:
APP_API_KEY: ${{ secrets.APP_API_KEY }}Give the placeholder a safe default
Where a value is optional in CI, supply a default so resolution never fails.
@Value("${app.api-key:}")
private String apiKey;How to prevent it
- Provide every externalized property in CI via env or secrets.
- Use defaults
${key:fallback}for values that are optional in CI. - Keep an application-ci.properties that defines CI-specific keys.