Home / Class/ SpringProperty Class — spring-boot Architecture

SpringProperty Class — spring-boot Architecture

Architecture documentation for the SpringProperty class in ApplicationPidFileWriter.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

core/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java lines 205–238

	private static class SpringProperty implements Property {

		private final String prefix;

		private final String key;

		SpringProperty(String prefix, String key) {
			this.prefix = prefix;
			this.key = key;
		}

		@Override
		public @Nullable String getValue(SpringApplicationEvent event) {
			Environment environment = getEnvironment(event);
			if (environment == null) {
				return null;
			}
			return environment.getProperty(this.prefix + this.key);
		}

		private @Nullable Environment getEnvironment(SpringApplicationEvent event) {
			if (event instanceof ApplicationEnvironmentPreparedEvent environmentPreparedEvent) {
				return environmentPreparedEvent.getEnvironment();
			}
			if (event instanceof ApplicationPreparedEvent preparedEvent) {
				return preparedEvent.getApplicationContext().getEnvironment();
			}
			if (event instanceof ApplicationReadyEvent readyEvent) {
				return readyEvent.getApplicationContext().getEnvironment();
			}
			return null;
		}

	}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free