Browse Source

Mark SystemEnvironmentPropertySource as immutable

Update `SystemEnvironmentPropertySourceEnvironmentPostProcessor` so
that our origin aware subclass is marked as immutable. This aligns
with the behavior we had before introducing origin tracking, which
assumes that environment variables changes made after the application
starts are not re-bound.

Closes gh-44859
pull/44866/head
Phillip Webb 9 months ago
parent
commit
ca9c3ed96d
  1. 7
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessor.java

7
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SystemEnvironmentPropertySourceEnvironmentPostProcessor.java vendored

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -121,6 +121,11 @@ public class SystemEnvironmentPropertySourceEnvironmentPostProcessor implements @@ -121,6 +121,11 @@ public class SystemEnvironmentPropertySourceEnvironmentPostProcessor implements
return this.prefix;
}
@Override
public boolean isImmutable() {
return (Object) getSource() == System.getenv();
}
}
}

Loading…
Cancel
Save