SystemEnvironmentConfigDataResource Class — spring-boot Architecture
Architecture documentation for the SystemEnvironmentConfigDataResource class in SystemEnvironmentConfigDataResource.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/main/java/org/springframework/boot/context/config/SystemEnvironmentConfigDataResource.java lines 39–99
class SystemEnvironmentConfigDataResource extends ConfigDataResource {
private final String variableName;
private final PropertySourceLoader loader;
private final Function<String, @Nullable String> environment;
private final @Nullable Charset encoding;
SystemEnvironmentConfigDataResource(String variableName, PropertySourceLoader loader,
Function<String, @Nullable String> environment, @Nullable Charset encoding) {
this.variableName = variableName;
this.loader = loader;
this.environment = environment;
this.encoding = encoding;
}
String getVariableName() {
return this.variableName;
}
PropertySourceLoader getLoader() {
return this.loader;
}
@Nullable List<PropertySource<?>> load() throws IOException {
String content = this.environment.apply(this.variableName);
return (content != null)
? this.loader.load(StringUtils.capitalize(toString()), asResource(content), this.encoding) : null;
}
private ByteArrayResource asResource(String content) {
return new ByteArrayResource(content.getBytes(StandardCharsets.UTF_8));
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
SystemEnvironmentConfigDataResource other = (SystemEnvironmentConfigDataResource) obj;
return Objects.equals(this.loader.getClass(), other.loader.getClass())
&& Objects.equals(this.variableName, other.variableName);
}
@Override
public int hashCode() {
return Objects.hash(this.variableName, this.loader.getClass());
}
@Override
public String toString() {
return "system environment variable [" + this.variableName + "] content loaded using "
+ ClassUtils.getShortName(this.loader.getClass());
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free