1) What is SpringBoot?
SpringBoot is a Spring module that provides rapid application development feature
to the Spring frameworks.
2) What is Spring Initializer?
Spring Initializer is a web based tool to generate the structure of SpringBoot
Project.
3)What are the SpringBoot Features?
1) Web development
2) Application events and Listeners
3) Admin Features
4) AutoConfiguration
5) Properties Files
6) YAML Support
7) logging
8) Security
9) Starters
10) Embeded Servers
11) Inbuilt Database
4)What is Spring Actuator?
->Springboot actuator is a subproject of the springboot framework to monitor and
manage the springboot applications.
->There are 3 features in the actuator
1)Endpoints
2)Metrics
3)Audit
->Some of the Built-in EndPoints:
1)Trace 2)Mappings 3)Metrics 4)loggers 5)Info 6)Health 7)beans
8)AutoConfig 9)Actuator 10) dump
5)What is SpringBoot CLI?
CLI - Stands for Command line Interface.
Springboot CLI is a tool to develop and test the springboot applications.
6)What are internal annotations of the @SpringBootApplication?
The @SpringBootApplication annotation contains three annotations internally.
1)@Configuration
2)@EnableAutoConfiguration
3)@ComponentScan
7)What is the purpose of using @ComponentScan in the class files?
Spring Boot application scans all the beans and package declarations when the
application initializes.
8)How does a spring boot application get started?
1)Spring Boot application must have a main method.
2)The main() is the entry point, which invokes the SpringApplication#run method to
bootstrap the application.
Example:
------------
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class);
// other statements
}
}
9)What are starter dependencies?
1)Spring boot starter is a maven template that contains a collection of all the
relevant transitive dependencies that are needed to start a particular
functionality.
2)we need to import spring-boot-starter-web dependency for creating a web
application.
Example:
-------
<dependency>
<groupId> org.springframework.boot</groupId>
<artifactId> spring-boot-starter-web </artifactId>
</dependency>
10)What are the key dependencies of Spring Boot?
The below are important Spring Boot dependencies.
spring-boot-starter-parent
spring-boot-maven-plugin
spring-boot-starter-test
spring-boot-starter-security
spring-boot-starter-actuator
Spring-boot-starter-web
11)What are Profiles in Spring Boot?
1)Springboot Profiles are used to map components and beans to specific profiles
like Dev,SIT,UAT and Prod.
2)In Spring Boot, the annotation @Profile is used to map components and beans to a
certain profile.
3)Developers can also set up profiles using the SpringApplication by using.
SpringApplication.setAdditionalProfiles("dev");
12)What is a Swagger in Spring Boot?
Swagger is used for documenting RESTful APIs in a machine-readable and human-
readable format.
13)Explain @RestController annotation in Sprint boot?
1)It is a combination of @Controller and @ResponseBody, used for creating a restful
controller.
2)It converts the response to JSON or XML.
14)What are the Embedded servers of SpringBoot?
There are three Embedded Servers in SpringBoot.
1)Tomcat
2)Jetty
3)Undertow
->Inbuilt Database is H2 in Springboot.
15)What is difference b/w @RestController and @Controller?
@Controller - It is like MVC controller.
@RestController - It is combination of @ResponseBody and @Controller annotation.
16)What are spme of important annotations in Springboot?
1) @SpringBootApplication
2) @RequestMapping
3) @Controller
4) @RestController
5) @RequestHeader
6) @RequestParam
7) @RequestBody
8) @PathVariable
9) @PathMapping
10) @GetMapping
11) @PostMapping
12) @DeleteMapping
13) @Repository
14) @Component
15) @Bean
16) @Autowired
17) @Qualifier
18) @Required
19) @Profile
17)What is difference b/w @Autowired and @Qualifier?
@Autowired - It is used to injecting the dependencies.
@Qualifier - It is used to avoid the ambiguity while injecting.
18)what is difference b/w @Component ,@Service , @ Controller and @Repository?
1)@Component is a generic stereotype annotation for any Spring-managed component or
bean.
2)@Repository is a stereotype annotation for persistence layer.
3)@Service is a stereotype annotation for the service layer.
4)@Controller is a stereotype annotation for presentation layer (spring-MVC).
19)What are the differences between JPA and Hibernate?
1)JPA is a Data Access Abstraction used to reduce the amount of boilerplate code
2)Hibernate is an implementation of Java Persistence API and offers benefits of
loose coupling.
20)What are the difference b/w @RequestParam and @PathVariable?
->Both annotations are used to extract data from URL.
1)@RequestParam is used to retrieve query parameters, anything add after ? in the
URL.
2)@PathVariable is used to retrieve values from URI itself.
21)What is difference b/w @RequestMapping and @GetMapping?
->@RequestMapping is used at the class level to maps HTTP requests to handler
methods.
->@GetMapping is used at method level to maps HTTP requests to handler methods.
22)What are the differences b/w SpringMVC and SpringBoot?
Spring MVC:
-----------
1) It follows MVC Architecture.
2) Deployment Descriptor is required.
3) It takes more time to development.
SpringBoot:
----------
1)It follows Layered Architecture.
2)Deployment Descriptor is not required.
3)It reduces the development time and increases Productivity.
23)What are the differences b/w Spring and SpringBoot?
Spring:
-------
1)Spring Used J2EE internally.
2)The Primary Feature is DI.
3)It helps to develop loosely coupling applications.
4)No Embeded Servers
5)No inmemory Database.
6)Need to add dependencies manually in POM.xml
SpringBoot:
-----------
1)SpringBoot used REST API's.
2)The Primary feature is AutoConfiguration.
3)It helps to develop standalone applications with less configuration.
4)Provided Embeded Servers
5)Inmemory Database like H2
6)The concept of starters dependencies will add internally.