# Spring Framework — The Enterprise Java Application Framework > Spring Framework provides comprehensive infrastructure for building Java applications with dependency injection, AOP, transaction management, and a modular architecture used in millions of production systems. ## Install Save as a script file and run: # Spring Framework — The Enterprise Java Application Framework ## Quick Use ```bash # Create a new project via Spring Initializr CLI curl https://start.spring.io/starter.zip -d dependencies=web -d type=maven-project -o demo.zip unzip demo.zip && cd demo ./mvnw spring-boot:run ``` ## Introduction Spring Framework is the foundational Java platform for building enterprise applications. It introduced dependency injection and aspect-oriented programming to the Java ecosystem, replacing heavyweight EJB-based development with a lightweight, testable approach that has become the de facto standard for server-side Java. ## What Spring Framework Does - Provides a powerful Inversion of Control (IoC) container for managing application components - Supports declarative transaction management across JDBC, JPA, and JMS - Offers a full-featured Web MVC framework with annotation-driven controllers - Integrates with virtually every Java persistence, messaging, and caching library - Enables aspect-oriented programming for cross-cutting concerns like logging and security ## Architecture Overview Spring's core is the IoC container, which reads bean definitions from annotations or XML, instantiates objects, resolves dependencies, and manages their lifecycle. On top of this sit modules for AOP (proxy-based interception), data access (JdbcTemplate, ORM integration), web (DispatcherServlet routing), messaging, and reactive programming (WebFlux). Each module is optional, so applications only load what they use. ## Self-Hosting & Configuration - Requires JDK 17 or later for Spring Framework 6.x - Projects are typically bootstrapped via start.spring.io or the Spring CLI - Configuration uses `@Configuration` classes or `application.properties` / `application.yml` - Embed Tomcat, Jetty, or Undertow as the servlet container, or deploy to an external server - Profiles (`@Profile`) allow environment-specific bean wiring for dev, staging, and production ## Key Features - Comprehensive dependency injection with constructor, setter, and field injection - First-class Kotlin support with null-safety and coroutines integration - Reactive programming via Spring WebFlux for non-blocking I/O - Extensive testing support with `@SpringBootTest`, MockMvc, and TestRestTemplate - Mature ecosystem including Spring Security, Spring Data, Spring Batch, and Spring Cloud ## Comparison with Similar Tools - **Jakarta EE (formerly Java EE)** — standards-based but heavier; Spring offers more flexibility and faster innovation - **Micronaut** — compile-time DI with faster startup; Spring has a larger ecosystem and community - **Quarkus** — optimized for GraalVM native images; Spring catches up with Spring Native / AOT - **Guice** — lightweight DI only; Spring provides a full application framework beyond injection - **Dropwizard** — opinionated REST bundle; Spring offers broader scope and more integrations ## FAQ **Q: What is the difference between Spring and Spring Boot?** A: Spring Framework is the core library providing DI, AOP, and web infrastructure. Spring Boot is an opinionated layer on top that auto-configures Spring applications with embedded servers and starter dependencies. **Q: Is Spring Framework suitable for microservices?** A: Yes. Combined with Spring Boot and Spring Cloud, it provides service discovery, circuit breakers, distributed configuration, and API gateways for microservice architectures. **Q: Does Spring support reactive programming?** A: Spring 5+ includes WebFlux, a fully reactive web framework built on Project Reactor, supporting non-blocking I/O with Netty or Undertow. **Q: How does Spring handle database transactions?** A: Spring provides declarative transaction management via the `@Transactional` annotation, supporting JDBC, JPA, Hibernate, and JTA transaction managers with configurable propagation and isolation levels. ## Sources - https://github.com/spring-projects/spring-framework - https://spring.io/projects/spring-framework --- Source: https://tokrepo.com/en/workflows/eda49dba-4408-11f1-9bc6-00163e2b0d79 Author: Script Depot