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

Filelizer relies on filesystem access; consider adding ability to load from classpath #2

Open
jottinger opened this issue May 9, 2024 · 1 comment

Comments

@jottinger
Copy link
Contributor

The tests are full of "src/test/resource/" locations, mandated by loading using File, etc. This is non-idiomatic; consider adding support for reading from classpath instead, so you could load from "src/test/resource/something_multiple" and "/something_multiple", with the latter being more preferable for testing scenarios. (The filesystem call would be a fallback.)

@jottinger
Copy link
Contributor Author

This is a pain to do, as it turns out: this was expected. (Spring and a few other frameworks have utilities to help, because it's a fairly common need but it's EXPENSIVE.) It's easy enough to DO, though: get the classloader, get the classpath from it, iterate over the resources in the classpath and look for matching resource names - you'd probably cache it on first scan so it's done once, and future requests would just iterate over the cache. But it IS potentially expensive (imagine a large project with spring boot and a bunch of other libraries).

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

No branches or pull requests

1 participant