-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Introduce getResources() method in ResourceLoader interface #26443
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
The
The default The same is true for the From the class-level Javadoc for
As mentioned above (in the Javadoc for That suggestion is focused on XML bean configuration, but the same applies to annotation driven configuration via With regard to your claim that you cannot autowire a @SpringJUnitConfig
class ResourceLoaderTests {
@Autowired
ApplicationContext context;
@Autowired
ResourceLoader resourceLoader;
@Autowired
ResourcePatternResolver resourcePatternResolver;
@Test
void test() throws Exception {
assertThat(context.getResource("classpath:/org/springframework/test/context/jdbc/schema.sql").exists()).isTrue();
assertThat(resourceLoader.getResource("classpath:/org/springframework/test/context/jdbc/schema.sql").exists()).isTrue();
assertThat(context.getResources("classpath*:/org/springframework/test/context/jdbc/*.sql")).hasSize(9);
assertThat(resourcePatternResolver.getResources("classpath*:/org/springframework/test/context/jdbc/*.sql")).hasSize(9);
}
@Configuration
static class Config {
}
} The above test class resides locally in my copy of the In light of the above, I am closing this issue. |
@sbrannen I am really sorry, for wasting your time, and I really appreciate your dedication in answer me. |
That's a good point. Thanks for mentioning that about the reference docs. I agree that it would be beneficial to discuss |
You are amazing guys! |
Uh oh!
There was an error while loading. Please reload this page.
I would like to suggest as new feature the possibility to add a
getResources()
method to theResourceLoader
interface, and if it accepted wildcards it would be even nicer. I assume there must be a rationale to prevent this, but just in case.I don't understand why the out-of-the-box auto-configured
ResourceLoader
implementation is not prepared for these needs.It seems to me, from my ignorance, that 90% of the apps would benefit from having a single central
ResourceLoader
that deals with all kinds of resources.Currently I cannot have an
@Autowired
ResourceLoader
, not even override it because I have to manually deal with concrete implementationPathMatchingResourcePatternResolver
.Thanks mates!
The text was updated successfully, but these errors were encountered: