spring-cloud / spring-cloud/spring-cloud-commons
BootstrapApplicationListener overrides custom environment
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 751
- Forks
- 744
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
The BootstrapApplicationListener defines its own environment when it creates the Spring Application using the Spring Builder. This overrides the custom environment we have provided for our application during the initial application run invocation.
We specify a custom environment class for our application for reasons specified in this issue
The BootstrapApplicationListener should provide a way for applications to specify their own environment class instead of defining its bootstrapEnvironment using new StandardEnvironment().
private ConfigurableApplicationContext bootstrapServiceContext(
ConfigurableEnvironment environment, final SpringApplication application,
String configName) {
**StandardEnvironment bootstrapEnvironment = new StandardEnvironment();**
MutablePropertySources bootstrapProperties = bootstrapEnvironment
.getPropertySources();
for (PropertySource<?> source : bootstrapProperties) {
bootstrapProperties.remove(source.getName());
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading BootstrapApplicationListener, especially bootstrapServiceContext, and trace how SpringApplication creates and receives its environment. Confirm the behavior with the existing bootstrap-related tests, then define and verify a way for the application's custom environment class to remain in effect during the initial bootstrap run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100