Codecademy Logo

Boots and Beans

Print Cheatsheet

Spring bean

A Spring bean refers to an object that’s managed by the Spring Inversion of Control (IoC) container.

@SpringBootApplication

Applying @SpringBootApplication to a Spring app’s main application class

  1. Enables Spring to identify the class as the configuration class that provides beans for the Spring application context
  2. Enables Spring to scan for and configure annotated classes as beans
  3. Enables Spring to configure beans based on code as well as jar dependencies

@SpringBootApplication is a compilation of the @Configuration, @EnableAutoConfiguration, and @ComponentScan annotations.

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ExampleApplication {
public static void main(String[] args) {
SpringApplication.run(ExampleApplication.class, args);
}
}

application context

The application context serves as a container into which Spring can inject beans.

Spring Boot

Spring Boot extends the Spring framework by enabling the autoconfiguration of Spring beans, further simplifying development.

application.properties

The application.properties file specifies the configuration properties of a Spring Boot application.