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.

Classpath Scanning in Spring Boot Jar Not Working

See original GitHub issue

I have a custom annotation:

@Target(value=ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Pipeline  {
  String id ();
  String name ();
  boolean visible () default true;
  String role () default "USER";
}

Which I use on interfaces within a Spring Boot App with nested jars:

@Pipeline(id="my-pipeline", name="My Pipeline")
public interface Echo {
  ...
}

My project structure:

parent-boot-project
   |
   --- plugin1.jar 
   --- plugin2.jar <--- interfaces are here
   --- ...

Next, I use lukehutch’s fast-classpath-scanner to scan for them:

new FastClasspathScanner(BASE_PACKAGE)
    .matchClassesWithAnnotation(PIPELINE_ANNOTATION, aProcessor)
    .verbose()
    .scan();

Works great on my IDE (eclipse) but not when I build the jar. Tried messing around with the classpath but to no avail. Anyone ran into something like that?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
CodingOXcommented, Jun 9, 2018

thanks… use fast-classpath-scanner in springboot jar, my problem got solved!!

2reactions
lukehutchcommented, Apr 12, 2017

@rmalchow You’re welcome. Should be fixed for good now, I had missed the case that you were triggering. Released in 2.0.19. Thanks again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Classpath Scanning in Spring Boot Jar Not Working
FastClasspathScanner makes assumptions that don't hold true with nested jars. Why not use Spring Framework's classpath scanning support instead?
Read more >
My Spring boot application is not scaning my components ...
Many Spring Boot developers have annotated their spring boot application class with @SpringBootApplication annotation. But we noticed that sometimes it failed ...
Read more >
Core Features - Spring
This section dives into the details of Spring Boot. Here you can learn about the key features that you may want to use...
Read more >
3.10 Classpath scanning and managed components - Spring
The scanning of classpath packages requires the presence of corresponding directory entries in the classpath. When you build JARs with Ant, make sure...
Read more >
Spring Boot Reference Documentation
jar files on your classpath. Spring Boot does not require any special tools integration, so you can use any IDE or text editor....
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