๐ค๐ญ. What Is Spring Boot and What Are Its Main Features? ๐ค
framework for rapid application development: starters, auto-config, actuator, security, logging.
๐ค๐ฎ. What Are the Differences Between Spring and Spring Boot? โ
Spring Boot makes configuring a Spring application a breeze.
๐ค๐ฏ. How Can We Set Up a Spring Boot Application With Maven? โ๏ธ
Inherit from the spring-boot-starter-parent maven project.
๐ค๐ฐ. What Is Spring Initializr? ๐
It creates a skeleton project for us.
๐ค๐ฑ. What Spring Boot Starters Are Available Out There? ๐
There are over 50 starters: core, aop, jpa, security, test, web...
๐ค๐ฒ. How to Disable a Specific Auto-Configuration? โ
Exlude it: @EnableAutoConfiguration(exclude = DataSourceAutoConfiguration.class).
๐ค๐ณ. How to Register a Custom Auto-Configuration? โบ๏ธ
Declare it in the EnableAutoConfiguration key in the META-INF/spring.factories file.
๐ค๐ด. How to Tell an Auto-Configuration to Back Away When a Bean Exists? ๐
Use @ConditionalOnMissingBean annotation.
๐ค๐ต. How to Deploy Spring Boot Web Applications as Jar and War Files? ๐ฆ
Add a plugin element to pom.xml: spring-boot-maven-plugin and set the packaging: jar.
๐ค๐ญ๐ฌ. How to Use Spring Boot for Command-Line Applications? ๐งโ๐ป
Launch the main method of the class containing @SpringBootApplication like any classic Java class.
๐ค๐ญ๐ญ. What Are Possible Sources of External Configuration? ๐ง
We can use properties files, YAML files...
๐ค๐ญ๐ฎ. What Does It Mean That Spring Boot Supports Relaxed Binding? ๐งโโ๏ธ
It means a property myProp can be bound to any of these environment properties: myProp, my-prop, my_prop, or MY_PROP.
๐ค๐ญ๐ฏ. What Is Spring Boot DevTools Used For? ๐งโ๐ง
Applications using DevTools restart whenever a file on the classpath changes.
๐ค๐ญ๐ฐ. How to Write Integration Tests? ๐
With @SpringBootTest.
๐ค๐ญ๐ฑ. What Is Spring Boot Actuator Used For? ๐งโโ๏ธ
It allows us to monitor and manage applications running in production.
๐ค๐ญ๐ฒ. Which Is Better to Configure a Spring Boot Project โ Properties or YAML? ๐ช
YAML
๐ค๐ญ๐ณ. What Basic Annotations Does Spring Boot Offer? ๐
@EnableAutoConfiguration, @SpringBootApplication
๐ค๐ญ๐ด. How to Change the Default Port in Spring Boot? โ
Use a properties file or set server.port in the @SpringBootApplication class or in the command line: java -jar -Dserver.port=8081 myspringproject.jar.
๐ค๐ญ๐ต. Which Embedded Servers Does Spring Boot Support, and How to Change the Default? ๐ฅ๏ธ
Tomcat, Jetty, and Undertow, change it in the pom.xml.
๐ค๐ฎ๐ฌ. Why Do We Need Spring Profiles? ๐ญ
Spring has the provision of profiles to help separate the configuration for each environment
#spring #java #programming #interviewquestion