Skip to content

Commit ca9c3ed

Browse files
committed
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
1 parent ae6908e commit ca9c3ed

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -121,6 +121,11 @@ public String getPrefix() {
121121
return this.prefix;
122122
}
123123

124+
@Override
125+
public boolean isImmutable() {
126+
return (Object) getSource() == System.getenv();
127+
}
128+
124129
}
125130

126131
}

0 commit comments

Comments
 (0)