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-projects-issues opened this issue Apr 7, 2016 · 3 comments
Assignees
Labels
in: test Issues in the test module type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

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-projects-issues
Copy link
Collaborator Author

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-projects-issues
Copy link
Collaborator Author

Andy Wilkinson commented

That was quick! Thanks, Sam.

@spring-projects-issues
Copy link
Collaborator Author

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
Labels
in: test Issues in the test module type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants