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

Issues with getMethodsAnnotatedWith() #327

Closed
Astralchroma opened this issue May 31, 2021 · 5 comments
Closed

Issues with getMethodsAnnotatedWith() #327

Astralchroma opened this issue May 31, 2021 · 5 comments

Comments

@Astralchroma
Copy link

If you create reflections with Reflections reflections = new Reflections("prefix here") then you cant use reflections.getMethodsAnnotatedWith() as it gives a ReflectionsException.

org.reflections.ReflectionsException: Scanner MethodAnnotationsScanner was not configured
	at org.reflections.Store.get(Store.java:39) ~[reflections-0.9.12.jar:?]
	at org.reflections.Store.get(Store.java:61) ~[reflections-0.9.12.jar:?]
	at org.reflections.Store.get(Store.java:46) ~[reflections-0.9.12.jar:?]
	at org.reflections.Reflections.getMethodsAnnotatedWith(Reflections.java:478) ~[reflections-0.9.12.jar:?]

Currently my solution is as follows:

Reflections reflections = new Reflections(new ConfigurationBuilder()
		.setUrls(ClasspathHelper.forPackage("prefix here"))
		.setScanners(new MethodAnnotationsScanner()));

Is this intended behavior or is this a bug?

@ljacqu
Copy link

ljacqu commented Jun 2, 2021

Yes, it's intended. Use new Reflections("prefix here", new MethodAnnotationsScanner()) for short

@Astralchroma
Copy link
Author

Astralchroma commented Jun 9, 2021 via email

@ronmamo
Copy link
Owner

ronmamo commented Sep 25, 2021

thanks @Peter-Crawley , added better javadoc and readme clarifications in the next 0.10 version branch - you mind taking a look?
as well, if you wish to take a closer look at the readme, I'd appreciate any comments - reach out on ronmamo at gmail

@ronmamo
Copy link
Owner

ronmamo commented Sep 25, 2021

also @ljacqu thanks for your continuous contributions 🙏 feel free to reach out, your comments are valuable

@ronmamo
Copy link
Owner

ronmamo commented Oct 5, 2021

fixed in 0.10

@ronmamo ronmamo closed this as completed Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants