Spring-Interview Questions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

1. What is Spring Boot and what are its Benefits?

Spring Boot represents a fusion of the lightweight Spring application framework,


configuration annotations, and embedded HTTP server.

Made available with an auto-configuration feature, and support for Spring Initializer,
Groovy, and Java, Spring Boot reduces Integration Test, Development, and Unit Test
time.

It aids the development of fast, responsive, and secure web applications, providing
users with a complete configuration and programming model for Java enterprise
applications.

Spring Boot, utilizing the core features of the Spring application framework, offers a
faster development technique for RESTful or REST architecture-based web services.

2. What makes Spring Boot superior to JAX-RS?

By leveraging Spring Boot features, users can experience significant advantages


over JAX-RS, including:

• Fast deployment

• High scalability

• Container compatibility

• Minimal configuration

• Lower production time

• Increased productivity

• Reduced development time

• Easy monitoring and management of applications

3. What is a Swagger in Spring Boot?


Swagger is used for clearly detailing and documenting RESTful APIs in a machine-
readable and human-readable format, which is easily comprehensible for testers and
developers, as well as individuals having little knowledge of source code.

Enabling hassle-free application discovery, development, and integration, Swagger


allows API consumers to interact with remote services with minimum
implementation logic.

4. How are the @RestController and @Controller Annotation different?

The traditional Spring @Controller annotation specifies that an annotated class


represents a controller. It’s basically a @Component specialization, and it is
autodetected via the classpath scanning. The @Controller annotation is used along
with the annotated handler methodologies based on @RequestMapping annotations.

Developers use the @RestController annotation to develop RESTful web services,


utilizing the Spring Model–View–Controller (MVC). The Spring @RestController
maps the request data to specified request handler methods. Once the handler
method generates the response body, the @RestController modifies it to XML or
JSON response.

5. What are the Spring Boot properties?


Spring Boot provides various properties which can be specified inside our
project's application.properties file. These properties have default values and you
can set that inside the properties file. Properties are used to set values like: server-port
number, database connection configuration etc.

You might also like