Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to TestPropertySourceUtils to add properties files directly to the environment [SPR-14131] #18703

Closed
spring-issuemaster opened this issue Apr 7, 2016 · 3 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Apr 7, 2016

Andy Wilkinson opened SPR-14131 and commented

TestPropertySourceUtils allows inlined properties to be added straight to a ConfigurableEnvironment but only allows properties file to be added to the environment via a ConfigurableApplicationContext.

In Boot we'd like to create and configure the environment, set it on SpringApplication and then run the application which creates the application context. However,
due to the current functionality provided by TestPropertySourceUtils, we're using an ApplicationContextInitializer to defer configuring the environment until the context has been created (see spring-projects/spring-boot@69b0829) so that we have a ConfigurableApplicationContext to pass to TestPropertySourceUtils.


Referenced from: commits 463c8f1

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 7, 2016

Sam Brannen commented

Completed in GitHub commit 463c8f1:

Add properties files directly to environment in TestPropertySourceUtils

This commit introduces a new method in TestPropertySourceUtils that
allows properties files to be added directly to the environment without
the need for a ConfigurableApplicationContext upfront; however, a
ResourceLoader is still necessary.

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 7, 2016

Andy Wilkinson commented

That was quick! Thanks, Sam.

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 7, 2016

Sam Brannen commented

You're welcome!

I just hope you're OK with the fact that you still have to provide a ResourceLoader. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.