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
This commit is contained in:
Phillip Webb
2025-03-22 19:29:34 -07:00
parent ae6908e4d8
commit ca9c3ed96d

View File

@@ -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
return this.prefix;
}
@Override
public boolean isImmutable() {
return (Object) getSource() == System.getenv();
}
}
}