Home
About Us
Contact Us
Bookmark
Saved Bookmarks
Current Affairs
General Knowledge
Chemical Engineering
UPSEE
BSNL
ISRO
BITSAT
Amazon
ORACLE
Verbal Ability
→
Programming
→
ASP Dot net Interview Questions in Programming
→
How can you change output artefact of Spring Boot...
1.
How can you change output artefact of Spring Boot application from jar to WAR?
Answer»
For this, you will extend SpringBootServletInitializer
@SpringBootApplication public class MyWebApplication extends SpringBootServletInitializer{ @
OVERRIDE
protected SpringApplicationBuilder
CONFIGURE
(SpringApplicationBuilder application) { return application.sources(MyWebApplication.class); } public static void main(String[]
ARGS
) { SpringApplication.run(MyWebApplication.class, args); } }
Packaging Type in pom.xml needs to be
DEFINED
as :
<packaging>war</packaging>
Add spring-boot-starter-tomcat as the provided
SCOPE
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
Show Answer
Discussion
No Comment Found
Post Comment
Related InterviewSolutions
What is ELK stack?
What is Cloud Foundry?
What is Reactive Programming? How it can be enabled using Spring?
What is Service Discovery and how it can be enabled in Spring Boot?
What is Hystrix and how it can be implemented in the Spring Boot application?
What is Spring Cloud Contract?
What is Microservices? How it is different from monolithic applications?
What is @Autowired annotation? How is @Qualifier used with it?
Explain the difference between @Controller and @RestController annotation?
What is HATEOS in RESTful applications?
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply
Your experience on this site will be improved by allowing cookies. Read
Cookie Policy
Reject
Allow cookies