-
Notifications
You must be signed in to change notification settings - Fork 41.1k
@TestPropertySource not recognizing yaml files #33434
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
Comments
It's currently not supported because @sbrannen any thought on this? Perhaps we could have a hook point to allow |
Yes, I'm thinking about introducing a new @philwebb and @wilkinsona, what do you think about that? |
At a first glance, the biggest challenge I foresee with supporting a custom One option would be to use the first (or last) custom configured factory to process all locations -- which would require that all locations configured via Another option would be to create some sort of map from file extension to factory -- though I'm not sure how we would want to support that mapping via annotation-based configuration. Perhaps instead of an external mapping, we could introduce the following default method in the default boolean supportsResource(@Nullable String name, EncodedResource resource) {
return true;
} Thoughts? |
I like the idea of aligning with I wonder if it would be possible to introduce a new method on |
I was also pondering introducing a new method in MCC.
Well, it turns out that we already have such a
So we could return a list of descriptors.
Indeed. |
Thanks, @sbrannen. Closing in favour of the Framework issue. |
FYI: the feature is already available in Spring Framework 6.1 snapshots in case anyone wants to try it out. |
Reopening to see if we can provide a YAML |
Any news on this issue? |
Spring Boot supports not only
application.properties
but alsoapplication.yml
files for long time now and we are using it in all our projects for better readability. But when it comes to testing with annotations like@TestPropertySource
then yaml files are not supported for whatever reason. If you try to specify a yml file as source, it does not complain but the test also won't be able to resolve the properties unless you are using the properties notation format and just store it with the.yml
file extension.I wonder why this is not supported yet. Is there another annotation I haven't seen yet or is there any plan to let
TestPropertySource
automatically recognize the file extension and make use of the corresponding yaml file loader?The text was updated successfully, but these errors were encountered: