jeudi 10 septembre 2020

How can I manage properties used in one Jar, when its referenced by many clients?

This is more of a design related issue :

I am having a jar file which takes a Configuration Object as input whenever any of its service class gets initialised.

Let's say, Jar "Maintenance" has multiple services

  1. BikeMainetenceService
  2. CarMaintenceService
    etc..

Now, all these service classes need few arguments (like engine type, cc, year of manufacturing...) to work out the methods in them. These arguments are passed runtime by the clients which are using this jar for ex., KTM-Client, Ducati-client, RollsRoyce-client,Jaguar-Client etc. I have bundled all these arguments in "Configuration" Bean which is passed from any client to this jar. This configuration contains values for the arguments mentioned above.

Every client have more/less same set of configurations arguments, which is configured via application.properties of each of this client. Now, the issue arises when there is any modification related to these configurations in my "Maiantence" Jar. For example, if there is new requirement to add of some "isAutomatedTransmisionAvailable" in Jaguar-client, I have to add this property in all the remaining clients also. This is making code difficult to manage.

Is there anyway to improve this. Any sprintboot feature to rescue?

(Note: the requirement is such that I cant have inheritance implemented and have a common parent say, "Vehicle" for these client classes)

Technologies used : Java8/Spring-Boot

And, Thank you for patiently reading this problem :)

Aucun commentaire:

Enregistrer un commentaire