InterviewSolution
| 1. |
Which Annotation do you use to enable Spring Boot? Elaborate? |
|
Answer» @SpringBootApplication is the primary annotation which needs to be added to the Application class or the MAIN class to the project and enables features like JAVA-BASED Spring configuration, component scanning, and auto-configuration. An Application class is used to BOOTSTRAP and launch a Spring application from a Java main method. This class automatically creates the ApplicationContext from the classpath, scan the configuration classes and launch the application. @SpringBootApplication is essentially a combination of below annotations:
Following parameters are accepted in the @SpringBootApplication annotation:
Example: package com.example.demoApplication; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication(exclude = { SecurityConfiguration.class }) public class Application { public static VOID main(String[] args) { SpringApplication.run(Application.class, args); } } |
|