vendredi 22 octobre 2021

Spring-Boot & Maven: Loading modules dynamically from a config file

I'm fairly new to Spring-Boot & Maven, so not entirely sure if this is possible. I'm trying to build an application by splitting the main source code into multiple modules. Here is an example:

com.my.project/
    --modules/
        --core/
        --api/
        --user_provider_1/
        --user_provider_2/

At the end of it all, I would like to run something like this:

java -cp api.jar user_provider_1.jar -jar core.jar

-or- 

java -cp api.jar user_provider_2.jar -jar core.jar

But is it possible to input these class-path jars from a config file somewhere? like: modules_to_load.xml

  <modules>
     <module name="api" path="api.jar"/>
     <module name="user_provider" path="user_provider_1.jar"/>
  <modules>

And then I execute something like this:

java -Dmodules=modules_to_load.xml -jar core.jar

Is this a possibility? or Is there a better way to approach this?

Aucun commentaire:

Enregistrer un commentaire