How to create Deployable WAR and JAR file by Spring Boot | Convert JAR to WAR and WAR to JAR

preview_player
Показать описание
#Deployable #WAR #JAR #File #Creation

Instagram: techtalk_debu

if you like my video, please subscribe to my channel and share the video

For Creating Jar :
1. Put the plugin int the POM.xml ( if you are using maven )
(build)
(plugins)
(plugin)
(artifactId)spring-boot-maven-plugin(/artifactId)
(/plugin)
(/plugins)
(/build)
By Default create JAR file in the traget folder

If you want to change the embedded Tomcat server put below in the POM.XML

(dependency)
(artifactId)spring-boot-starter-web(/artifactId)
(exclusions)
(exclusion)
(artifactId)spring-boot-starter-tomcat(/artifactId)
(/exclusion)
(/exclusions)
(/dependency)

(dependency)
(artifactId)spring-boot-starter-jetty(/artifactId)
(/dependency)

2. Creating WAR File :

(packaging)war(/packaging)

(dependency)
(artifactId)spring-boot-starter-tomcat(/artifactId)
(scope)provided(/scope)
(/dependency)

and then your main class looks like below : ( which extends the SpringBootServletInitializer class )

@SpringBootApplication
public class SecondInitilize extends SpringBootServletInitializer {
public static void main(String[] args) {
}

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
}
}

Thanks & Regards,
Debu Paul
Рекомендации по теме
Комментарии
Автор

Great Job Keep it up! Explanation is also understandable. Need to some improvement show the created war and jar

sonyguptayourdearestsony
Автор

Can you explain How to deploy jar file in production environment

vijayrao
Автор

why we have both the classes InitializeApp and SecondInitializeApp at a time? only one main class required to run ? or u just showed these classes to identify the differences clearly ? Can we create a WAR without extending the SpringBootServletInitializer ?

muhassinmusthafaa