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

When prefix of Reflections is blank string, cannot find subTypes in whole classpath scope. #315

Closed
l4wei opened this issue Jan 11, 2021 · 2 comments

Comments

@l4wei
Copy link

l4wei commented Jan 11, 2021

Version: 0.9.12.
Problem code: Reflections reflections = new Reflections("");
Description: Must package the program be a jar, this problem will be happened.

@Kaktushose
Copy link

Okay, so for anyone also having this issue, I've found a solution.

new Reflections(new ConfigurationBuilder()
    .setScanners() // the scanners you need
    .setUrls(ClasspathHelper.forClass(getClass()))
);

@ronmamo
Copy link
Owner

ronmamo commented Sep 25, 2021

thanks @l4wei and @Kaktushose , it is preferred to use ConfigurationBuilder so that urls are correctly resolved from classpath. I've updated the docs and will update further.

@ronmamo ronmamo closed this as completed Sep 25, 2021
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

3 participants