springboot_notes
springboot_notes
=> annotation in Spring Boot is a composite annotation, which means that it combines
multiple important annotations to make setting up a Spring Boot application
Like . @Configuration, @EnableAutoConfiguration, @ComponentScan,
7) what is purpose of using @ComponentScan in the class file ?
=>@ComponentScan, which automatically scans the current package and sub-packages for
Spring components.
8) how does spring boot application get started ?
=>A Spring Boot application gets started in a straightforward and automated manner. The
process involves initializing the Spring application context, configuring necessary
components, and starting the application with an embedded server
1) @SpringBootApplication
2) SpringApplication.run()
3) Spring Boot Actuator
4) Externalized Configuration
5) Shutting Down the Application
9) what is spring initializer.
=> Spring Initializr is a web-based tool provided by Spring that helps developers quickly
generate a Spring Boot project with a specific configuration.
14) It is possible to change the port of the embedded tomcat server in spring boot ?
=> yes , it is possible to change port address in spring boot inside the application.properties
File like Server.port=8081
=> 8080
16) Can we override or replace embedded tomcat server in spring boot ?
=> yes , To replace Tomcat with Jetty, you need to exclude the Tomcat dependency and
include the Jetty dependency in your pom.xml
17) Can we disable the default web server in the spring boot application ?
=> Yes , by adding property in application.properties folder spring.main.web-application-
type=none.
Primary Used for MVC applications Used for REST APIs (serving raw
Use (serving views) data like JSON )
Default Returns views (e.g., Automatically serializes data to
Behavior HTML, JSP) JSON or XML
=>Using application.properties
logging.level.root=DEBUG
logging.level.org.springframework.security=DEBUG
logging.level.com.example.myapp=DEBUG
Type of Can map any HTTP request (GET, Specifically for HTTP
Request POST, PUT, DELETE, etc.) GET requests
=> Spring Boot Actuator provides production-ready features such as monitoring, metrics,
health checks, and more.
1. Add Spring Boot Actuator Dependency
2. Enable and Configure Endpoint
3. Accessing Actuator Endpoints
4. Example of a Full Configuration
=> spring boot IOC stand for Inversion of controller, it is create object and configure and
assemble dependencies and manage entire life cycle
=> spring boot depencies injection is a design pattern that allow developer to build application
that are easier to test, maintain and loosely coupled.
=> @Autowired configuration is use to atomatically configure external class like repositore
1) Auto-configuration
2) CLI
3) Actuator
4) embedded server
33) . What are the differences between @SpringBootApplication and @EnableAutoConfiguration
annotation?
@SpringBootApplication @EnableAutoConfiguration