Spring is a Java application framework for building applications from cooperating components. Its core is a container called the Spring application context. The context creates and manages components, called beans, and connects them so they can work together. section 1.1
Those connections use dependency injection. Instead of having one component create another component it needs, the container supplies the dependency, often through a constructor. For example, a product service can receive an inventory service so it can include inventory levels in product information. section 1.1
@Configuration
public class ServiceConfiguration {
@Bean
public InventoryService inventoryService() {
return new InventoryService();
}
@Bean
public ProductService productService() {
return new ProductService(inventoryService());
}
}
This Java configuration declares both services as beans and passes the inventory service to the product service. It makes the container’s wiring visible in a small example. section 1.1
Spring offers more than its container. The core framework includes Spring MVC for web requests and REST APIs, JdbcTemplate for JDBC-based data access, and Spring WebFlux for reactive web applications. Related libraries add options for security, integration, monitoring, and microservices. section 1.4.1 section 1.1
Spring Boot makes a small Spring web application quicker to start:
- Create a project with Spring Initializr, then write a controller, a view template, and a test for a home page. section 1.3.6
- Add Web and Thymeleaf starters to pom.xml. Their dependencies bring in Spring MVC, embedded Tomcat, and Thymeleaf. section 1.3.6
- At startup, Spring Boot autoconfiguration detects those libraries and configures supporting beans. Application code can stay focused on the home page rather than most framework setup. section 1.3.6
Beans can also be declared explicitly with Java or XML, or found through component scanning. Spring Boot adds automatic configuration and simplified dependency management; it builds on Spring rather than replacing it. section 1.5


