0% found this document useful (0 votes)
7 views

SpringBoot

Spring Boot is a framework that simplifies Java application development through pre-configured setups and auto-configuration. It enhances the core Spring framework by reducing boilerplate code, managing dependencies, and providing embedded servers. Key concepts include application properties, auto-configuration, RESTful API development, and security features, making it easier to create and deploy applications.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

SpringBoot

Spring Boot is a framework that simplifies Java application development through pre-configured setups and auto-configuration. It enhances the core Spring framework by reducing boilerplate code, managing dependencies, and providing embedded servers. Key concepts include application properties, auto-configuration, RESTful API development, and security features, making it easier to create and deploy applications.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Basics of Spring Boot


What is Spring Boot?
Spring Boot is a framework that simplifies Java application development by
providing pre-configured setups, auto-configuration, and embedded servers.

What are the advantages of Spring Boot?


It reduces boilerplate code, simplifies dependency management, provides embedded
servers, and allows rapid application development.

What is the difference between Spring and Spring Boot?


Spring is a core framework for Java, while Spring Boot is a specialized framework
that builds on Spring, simplifying its configuration and deployment.

2. Spring Boot Core Concepts


What is the purpose of application.properties?
It allows configuration of application properties, such as server port, database
connection, etc.

What is auto-configuration in Spring Boot?


It automatically configures Spring beans based on the classpath and properties,
reducing manual configuration.

What is the use of @SpringBootApplication?


It’s a composite annotation combining @Configuration, @EnableAutoConfiguration, and
@ComponentScan.

3. Dependency Management
What is the role of Maven/Gradle in Spring Boot?
They handle dependency management and project build automation.

How do you exclude a specific dependency in Spring Boot?


Use the <exclusion> tag in Maven or the exclude keyword in Gradle

4. Spring Boot Annotations


What does @RestController do?
It combines @Controller and @ResponseBody, simplifying REST API development.

What is @ComponentScan used for?


It scans for components, configurations, and services in specified packages.

What is the use of @Qualifier?


It resolves ambiguity when multiple beans of the same type exist.

5. RESTful API Development


How do you create a REST endpoint in Spring Boot?
Use @RestController and HTTP method annotations like @GetMapping.

What is the difference between @RequestBody and @RequestParam?


@RequestBody maps request body to a Java object, while @RequestParam maps query
parameters to method arguments.

What is @PathVariable?
It extracts values from the URI template.

6. Spring Data JPA and Database


What is Spring Data JPA?
It simplifies database interaction using repositories and query methods.

What is the purpose of @Entity?


It marks a class as a JPA entity for mapping to a database table.

What are the methods in JpaRepository?


Common methods include findAll(), findById(), save(), and deleteById().

7. Security
What is Spring Security?
It provides authentication, authorization, and protection against common attacks.

How do you secure a Spring Boot application?


By adding spring-boot-starter-security and configuring user roles and
authentication mechanisms.

What is CSRF protection in Spring Security?


It prevents cross-site request forgery attacks by validating requests with tokens.

8. Spring Boot Features


What is an actuator in Spring Boot?
It provides production-ready features like monitoring, metrics, and health checks.

What is DevTools in Spring Boot?


It enables hot swapping and automatic restarts during development

9. Deployment and Testing


How do you deploy a Spring Boot application?
Package it as a JAR or WAR and deploy it on an embedded server or external
container.

What is the use of @SpringBootTest?


It provides an integrated test environment for Spring Boot applications.

10. Miscellaneous
What is a Bean in Spring Boot?
A Java object managed by the Spring IoC container.

How does Spring Boot handle exceptions?


Using @ControllerAdvice and @ExceptionHandler.

What is the default embedded server in Spring Boot?


Tomcat.

In Spring Boot, IoC ensures that object creation and dependency management are
centralized in the container, while DI provides a way to supply dependencies.
Together, they make applications more modular, testable, and easier to maintain.

You might also like