Ankush
Ankush

Reputation: 93

Deploying Independent (Different Maven Project) Rest Service Jar in another standalone/embedded jetty server

I am in very initial stage of our application design. I am trying to decouple application business logic in different (module) Maven projects. All Maven projects will have their own data access layer ( I am using Spring data for this), and independent Rest Service interface.

Now I have tried using spring boot, but spring boot creates standalone executable jar files for each module. But I need to somehow deploy all module jars into single Jetty instance.

I am somewhat trying to implement both micro services and single fat application. Reason being, There may be few clients where user traffic is comparatively very low. So, in such scenarios I feel running independent Jetty for all rest module will be over-kill. But there may be few client where expected user data load is very huge. So, I am trying to implement a flexible solution to meet of requirement.

Can you please suggest if there is anything wrong in my approach.

Upvotes: 2

Views: 154

Answers (1)

glytching
glytching

Reputation: 47895

If you change the Maven packaging type from jar to war then the distro will be a WAR file rather than an uber JAR. The WAR file can then be deployed to a standard servlet container, like Jetty.

To facilitate bundling both an uber JAR and a WAR you could adopt one of the following approaches:

  • Define separate bundle modules each of which depends on your 'business' module, one of which would have <packaging>war</packaging> and the other would have <packaging>jar</packaging>
  • Use a Maven profile to set the packaging value, here's an example.

Upvotes: 1

Related Questions