1

I want to create a project in spring boot in module pattern, there are four modules in my project moduleA, moduleB, moduleC and moduleD. moduleB contains the a interface. moduleC and moduleD contains the implementation of interface that is present in the moduleB. all the modules have thier own pom.xml. moduleA contain the spring boot main application where i am using the interface and want the implementation of that module that i pass(jar) at runtime. i dont want to mention the dependency of the implementation module in our moduleA's pom. i want when i run my application it should pick that implementaion that i provide at runtime, i can choose any implementation at runtime andmy app should able to pick that implementation without mentioning it to the pom of my application. i dont want to use @qualifier becouse before runtime i dont have any information that which implementation jar i am providing.

i have craeted all the module as mentioned above and run my application in eclipse by adding the jar of the implementation in the classpath as external jar it is not able to pick the implementation jar.

hunter
  • 11
  • 1

1 Answers1

0

You can add extra JARs to the classpath of a Spring Boot application with something like

java -cp app.jar:lib.jar org.springframework.boot.loader.JarLauncher

app.jar is your application, and lib.jar contains the implementations of the interfaces. (But the order doesn't matter).

ekalin
  • 872
  • 7
  • 19