ConfigDataResourceNotFoundException class final
The startup error for a config file that must exist and does not, such
as spring.config.import=file:./secrets.yml when there is no
secrets.yml.
A location is required unless it starts with optional:; the default
locations, profile variants (application-dev.yml) and imports marked
optional: never fail. The message names the location and suggests the
prefix. Applications meet it as a failed start and fix the location or
add optional:; spring.config.on-not-found=ignore makes every
location optional. A missing configtree: directory fails the same
way.
// application.properties: spring.config.import=file:./missing.properties
try {
await ConfigDataEnvironment(environment).processAndApply();
} on ConfigDataResourceNotFoundException catch (error) {
log.error(error.location); // file:./missing.properties
}
Spring (Java):
// Thrown by SpringApplication.run for a missing non-optional
// spring.config.import / spring.config.location.
try {
SpringApplication.run(App.class, args);
} catch (ConfigDataResourceNotFoundException ex) {
log.error(ex.getMessage());
}
- Implemented types
Constructors
- ConfigDataResourceNotFoundException(String location, String description)
-
Creates the exception for
location, which was looked up as the resource described bydescription.
Properties
- description → String
-
The resource that was looked for, such as
file [/srv/shop/secrets.yml].final - hashCode → int
-
The hash code for this object.
no setterinherited
- location → String
-
The location as it was written, such as
file:./secrets.yml.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited