For Gradle Spring Boot how do I choose dependency with implementation

0 votes

I have library X with pure interfaces, libraries X1, X2, X3, ..., XN which implement interfaces from X and SpringBoot project Y built with Gradle 4 and using X

The implementation of X depends on the client we prepare build for.

Options I have in mind:

  • Include all implementation as dependencies and have configuration variable which will be discovered runtime and define used implementation.
  • Conditional Gradle build gradle build -Pclient=client1 which will include only one specific implementation

So which among those is best to follow? Can anyone help me with this?

thanks

Jun 17, 2018 in DevOps Tools by Atul
• 10,240 points
736 views

1 answer to this question.

0 votes

Below is the answer to your question:

Both mechanisms of handling the presented problem are more or less equivalent. I find including only single dependency (namely XN) not only easier to implement using this technology stack but also more reliable:

  • reliable because there's only one particular dependency found on runtime - it's impossible that spring will mess something up with DI
  • easier because if only one implementation is included there's no need for manually handling DI.
  • if only single implementation will be used at runtime - what's the reason for including the else?

Two important things here:

  • provide a detailed log message not only which implementation is included (during build time) but also which one is used (during runtime)
  • it can be done in gradle in two different ways on war level or in dependencies block. Personally I'd go for dependencies block - it make war easier to build.

Hope above explanation will help you.

answered Jun 17, 2018 by shubham
• 7,340 points

Related Questions In DevOps Tools

0 votes
1 answer

How do I run “ant update” in Hybris with only “Update Running System”?

Here is what you can try. You can ...READ MORE

answered Jul 10, 2018 in DevOps Tools by Atul
• 10,240 points
7,106 views
0 votes
1 answer

How do I set maximum queue connection for nginx port in Windows?

Since increasing queue size did not fix your problem ...READ MORE

answered Aug 22, 2018 in DevOps Tools by Damon Salvatore
• 5,980 points
1,121 views
0 votes
1 answer

How do I kill Wagtail server?

Here is the explanation regarding the above ...READ MORE

answered Jun 25, 2018 in DevOps Tools by anonymous
815 views
+1 vote
3 answers

How do I check and export sonarqube analysis reports in embedded db?

Browse to sonarqube web instance to access ...READ MORE

answered Jul 2, 2018 in DevOps Tools by DareDev
• 6,890 points
28,164 views
0 votes
1 answer

How do I deploy to multiple servers using the same context root?

  If you're deploying to multiple servers ...READ MORE

answered Jul 2, 2018 in DevOps Tools by Kalgi
• 52,360 points
752 views
0 votes
1 answer

How to manage multiple components with IBM Bluemix Track & Plan

As of now, there is not a ...READ MORE

answered Jul 6, 2018 in DevOps Tools by Kalgi
• 52,360 points
542 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,941 views
+2 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP