2

I'm working on a Spring extension (implementing some logic in a bean that will be constructed by Spring and provide some useful features to a developer). Is there a way to get basePackages (ComponentScan uses it to find our beans) value from my bean?

UPD: no, I know how to scan a classpath. I want to know what packages a current instance of Spring ApplicationContext did scanned to find it's beans.

  • 1
    Possible duplicate of [Scanning Java annotations at runtime](https://stackoverflow.com/questions/259140/scanning-java-annotations-at-runtime) – mallikarjun Jul 06 '18 at 12:45

1 Answers1

0

No, there is no way to get this value at runtime without the help of reflection.

Spring uses basePackages that you've specified in the configuration, if you did it, otherwise it uses the package of your entry point class as a basePackages value by default.