Home / Class/ OriginAwareSystemEnvironmentPropertySource Class — spring-boot Architecture

OriginAwareSystemEnvironmentPropertySource Class — spring-boot Architecture

Architecture documentation for the OriginAwareSystemEnvironmentPropertySource class in SystemEnvironmentPropertySourceEnvironmentPostProcessor.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

core/spring-boot/src/main/java/org/springframework/boot/support/SystemEnvironmentPropertySourceEnvironmentPostProcessor.java lines 106–156

	protected static class OriginAwareSystemEnvironmentPropertySource extends SystemEnvironmentPropertySource
			implements PropertySourceInfo, OriginLookup<String> {

		private final @Nullable String prefix;

		OriginAwareSystemEnvironmentPropertySource(String name, Map<String, Object> source,
				@Nullable String environmentPrefix) {
			super(name, source);
			this.prefix = determinePrefix(environmentPrefix);
		}

		private @Nullable String determinePrefix(@Nullable String environmentPrefix) {
			if (!StringUtils.hasText(environmentPrefix)) {
				return null;
			}
			if (environmentPrefix.endsWith(".") || environmentPrefix.endsWith("_") || environmentPrefix.endsWith("-")) {
				return environmentPrefix.substring(0, environmentPrefix.length() - 1);
			}
			return environmentPrefix;
		}

		@Override
		public boolean containsProperty(String name) {
			return super.containsProperty(name);
		}

		@Override
		public @Nullable Object getProperty(String name) {
			return super.getProperty(name);
		}

		@Override
		public @Nullable Origin getOrigin(String key) {
			String property = resolvePropertyName(key);
			if (super.containsProperty(property)) {
				return new SystemEnvironmentOrigin(property);
			}
			return null;
		}

		@Override
		public @Nullable String getPrefix() {
			return this.prefix;
		}

		@Override
		public boolean isImmutable() {
			return (Object) getSource() == System.getenv();
		}

	}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free