ðĪð. 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