Pankaj
Pankaj

Reputation: 33

how to deploy angular 5 with spring boot in a single war or jar file on tomcat server

I am using angular 5 as client side and spring boot as server side along with Mongo db. I have two separate contents but my confusion is how to integrate it into a one WAR or JAR file and deploy on tomcat 8 server.

Upvotes: 0

Views: 2908

Answers (1)

Brain
Brain

Reputation: 440

I have found some answers on a blog stating the reasons why a Angular5 cannot be deployed easily on a Tomcat (which is similar to spring boot, because it embeds a tomcat).

  • angular apps need a lot of dependencies, node package manager of node js server helps tremendously in dependency management and compilation of angular apps.
  • Tomcat does not support javascript dependency management or typescript
  • Even though we develop angular apps using typescript, they are ultimately converted into javascript. Hence when we deploy angular app in tomcat, we are actually putting javascript files in it.

Essentially you need to distill your code with

ng build --base-href=/angular/

The distilled code can be then deployed into a tomcat or jetty or can be copied into a static folder of a spring-boot application. Note the "base-href", this parameter is very important in order that your angular gui can run.

Source: Deploy angular app in tomcat

Upvotes: 2

Related Questions