We have a Spring Boot + Angular application. Currently we are packaging it as a jar and running it.
Is it ok to use the packaging as a JAR? Or should we move to a WAR type packaging. What would be the difference?
We have a Spring Boot + Angular application. Currently we are packaging it as a jar and running it.
Is it ok to use the packaging as a JAR? Or should we move to a WAR type packaging. What would be the difference?
The difference is nothing else apart from the deployment style.
When using a JAR, the fat JAR that spring boot creates contains embedded tomcat.
If your team's deployment environment has a Application server like WebLogic or Websphere etc., which most enterprise environment try to choose as they already have license for these or any other such reasons, you would need to create a WAR.
For WAR:
Pros :
Cons:
Spring Boot can be told to produce a WAR file, in which case you'll likely choose to deploy it to a web container such as Tomcat or Jetty.
Spring Boot can also be told to produce a JAR which includes all of your module/service's dependencies and can be run with java -jar .
Easy way : You can go to your application.yml file and mention all environment profile details like below:
spring: profiles: default
spring: profiles: dev
spring: profiles: QA
spring: profiles: PROD
After in application.properties file just mention the active profile as below
spring.profiles.active=QA or Dev or prod