question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with getMethodsAnnotatedWith()

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ronmamocommented, Sep 25, 2021

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

0reactions
ronmamocommented, Oct 5, 2021

fixed in 0.10

Read more comments on GitHub >

github_iconTop Results From Across the Web

getMethodsAnnotatedWith doesn't work in Production Context ...
Hi there, I have a problem with the ReflectionService (Flow 4.3.3). ... the annotation but only getMethodsAnnotatedWith() doesn't work!?
Read more >
java - Is there a more efficient way to get an annotated method?
There's a Reflections#getMethodsAnnotatedWith() which suits your functional requirement. Here's an SSCCE, just copy'n'paste'n'run it.
Read more >
ScanningStepsFactory.java - What is JBehave?
* An {@link InjectableStepsFactory} that scans for classes in the classpath. * The constructors allows the specification of the package names to scan...
Read more >
Java – more efficient way to get an annotated method – iTecNote
There's a Reflections#getMethodsAnnotatedWith() which suits your functional requirement. Here's an SSCCE, just copy'n'paste'n'run it.
Read more >
Bountysource
Issues with getMethodsAnnotatedWith () ... Posted by. See More. View in. SOLVE ISSUE. Overview; Backers (); Updates. Backers, Amount, Date. Updates.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found