I have a situation a work where we have several jar filed in npm packages. If I add all the paths to the classpath before running my spring mvc app, it works fine.
But we want a "modular" way of doing this. IE, I don't know of all the packages that may or may not be there at runtime. I have a base folder, and I can easaly do a recusive file scan for all jar files, but how do I then load them before the component scan so everything is wired in correctly? I have this standard in my base Application class:
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
I assume I have to do something in my main() before I call run(), but im not sure what to do.
EDIT I have been trying to get this to work, and forgot to mention that this is a .war file in a tomcat container, and I don't think the main() method is being called.