A Spring application context is the container that creates and manages an application’s components, called beans. It also connects beans that depend on each other. Instead of making a product service create its own inventory service, the context can supply that dependency when it creates the product service. This is dependency injection. section 1.1
@Configuration
public class ServiceConfiguration {
@Bean
public InventoryService inventoryService() {
return new InventoryService();
}
@Bean
public ProductService productService() {
return new ProductService(inventoryService());
}
}
In this Java configuration example, @Bean methods declare the two services. The product service receives the inventory service through its constructor. section 1.1
You do not have to declare every bean yourself. Beans can be declared with Java or XML, found through component scanning, or configured automatically by Spring Boot. With web and Thymeleaf starters present, Boot configures beans for Spring MVC, an embedded Tomcat server, and a Thymeleaf view resolver. section 1.5 section 1.3.6
Listing 1.2 The Taco Cloud bootstrap class
package tacos;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication #1
public class TacoCloudApplication {
public static void main(String[] args) {
SpringApplication.run(TacoCloudApplication.class, args); #2
}
}
The bootstrap class starts the application with SpringApplication.run. It is a practical starting point for seeing how a Spring Boot application launches. section 1.2.2
Listing 1.3 A baseline application test
package tacos;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest #1
public class TacoCloudApplicationTests {
@Test #2
public void contextLoads() {
}
}
A minimal @SpringBootTest with an empty contextLoads test checks that the application context starts successfully. section 1.2.2
During development, Spring Boot DevTools can restart the application context after project code or property files change. A dependency change still needs a full restart because DevTools does not automatically reload dependency libraries. section 1.3.5

