"Welcome To Ashok IT" "Spring Boot and MicroServices" Topic : SpringBootMVC Development Date : 11/12/2024 (Session - 83) _____________________________________________________________________________________________________________________________ Generating the WAR File For Spring Boot Application =================================================== * During the Spring Boot MVC project creation we have two packages modes 1) JAR 2) WAR * If we want to deploy our spring boot mvc application into embedded servers then we need to choose package as "JAR". If we want to deploy our spring boot mvc appplication into external Server then we need to choose package as "WAR" * In order to generate the WAR file for our spring boot mvc project we need to run following maven goal i.e.,install 1) Right click on Project >>>>> select "Run as" option >>> select "Maven Install". 2) Right click on Project >>>>> select "Run as" option >>> select "Maven build" option >>> Specify the maven goals in goals textfield(clean install) clean >>>>>>>>>>> deleting target folder in our project install >>>>>>>>> compiling the source code & Generating WAR File in target Folder. * Onces we got the WAR File of spring boot mvc application we can deploy that application into Tomcat9/Tomcat10 server with following options. 1) Copy and paste the above generated WAR File into tomcat10 server "webapps" folder. 2) By Using Tomcat10 manager console we do have option "Browse the war file to be deployed". * When we are talking about spring boot features we have embedded servers support for spring boot mvc application development 1) Tomcat (Default) >>>>>> spring-boot-starter-web 2) Jetty 3) Undertow Steps for Deploying application into Jetty Embedded Server =========================================================== * When we select web Starter during spring boot project creation by default will get Embedded server as Tomcat. * If we want to deploy the spring boot mvc application into Jetty Embedded Server we need to following below steps 1) We need to exclude the tomcat-starter under the web starter with following entries in pom.xml. org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat 2) We need to add the Jetty starter in pom.xml with following entry. org.springframework.boot spring-boot-starter-jetty provided 3) We need to add below tag in pom.xml in tag 5.0.0 Steps for Deployed application into Undertow Embedded Server ============================================================ * When we select web Starter during spring boot project creation by default will get Embedded server as Tomcat. * If we want to deploy the spring boot mvc application into Undertow Embedded Server we need to following below steps 1) We need to exclude the tomcat-starter under the web starter with following entries in pom.xml. org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat 2) We need to add the Undertow starter in pom.xml with following entry. org.springframework.boot spring-boot-starter-undertow provided Spring Boot Dev Tools ===================== * When we are doing changes in the project continously for every time to test the changes we need to stop server and start the server again and again which will be taking more time for development. * In order to overcome the problem spring boot provided one dependency as "Dev tools" automatically taking changes and deploying into server instantly with out stop and starting server again and again which will increases for more productivity for the development. NOTE ==== * Spring Boot Dev Tools is not starter dependency and its just like simple maven dependency. pom.xml ======= org.springframework.boot spring-boot-devtools ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++