Backend
home

[Spring 공식문서 읽기] Spring Framework Overview 1

생성 일시
2025/10/09 01:16
태그
SpringBoot
게시일
2025/10/09
최종 편집 일시
2025/10/12 08:39

참고 링크

원문 1

Spring makes it easy to create Java enterprise applications. It provides everything you need to embrace the Java language in an enterprise environment, with support for Groovy and Kotlin as alternative languages on the JVM, and with the flexibility to create many kinds of architectures depending on an application’s needs. As of Spring Framework 6.0, Spring requires Java 17+.

번역

Spring은 Java 엔터프라이즈 애플리케이션을 쉽게 개발할 수 있도록 도와주는 프레임워크이다.
Java 언어를 기반으로 한 엔터프라이즈 환경에서 필요한 모든 기능을 제공하며,
JVM 위에서 Groovy와 Kotlin 같은 대체 언어도 지원한다.
또한, 애플리케이션의 요구사항에 따라 다양한 아키텍처를 유연하게 설계할 수 있는 구조를 제공한다.
Spring Framework 6.0부터는 Java 17 이상이 필수다.

요약

1.
Spring은 Java 기반 엔터프라이즈 애플리케이션 개발의 복잡성을 단순화한다.
2.
JVM 위의 다언어 환경(Groovy, Kotlin)을 지원하여 유연한 개발 생태계를 제공한다.
3.
Spring 6.0부터는 Java 17 이상이 필수이며, 이는 최신 JVM 기능을 적극 활용하기 위함이다.

예제 코드

// src/main/java/com/example/demo/DemoApplication.java package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication // Spring Boot의 자동 설정, 컴포넌트 스캔, 설정 등록을 활성화 public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); // 엔터프라이즈 앱을 간단히 실행 } }
Java
복사
@SpringBootApplication 하나로 설정, DI, 서버 실행까지 모두 처리된다.
과거에는 복잡한 XML 설정이 필요했지만, 지금은 코드 한 줄이면 “서버 기반 애플리케이션”이 돌아간다.

원문 2

Spring supports a wide range of application scenarios. In a large enterprise, applications often exist for a long time and have to run on a JDK and application server whose upgrade cycle is beyond the developer’s control. Others may run as a single jar with the server embedded, possibly in a cloud environment. Yet others may be standalone applications (such as batch or integration workloads) that do not need a server.

번역

Spring은 다양한 애플리케이션 시나리오를 지원한다.
대규모 엔터프라이즈 환경에서는, 애플리케이션이 긴 수명 주기를 가지며,
개발자가 직접 제어할 수 없는 JDK 버전이나 애플리케이션 서버에서 실행되어야 하는 경우가 많다.
반면, 어떤 애플리케이션은 서버를 내장한 단일 JAR 형태(single jar)로 실행되며,
클라우드 환경에서 구동되기도 한다.
또 다른 경우로, 배치 작업(batch)이나 시스템 통합(integration) 등 서버가 필요 없는 독립 실행형
애플리케이션도 있다.

요약

1.
Spring은 레거시 서버 환경부터 클라우드 네이티브 앱까지 모두 대응한다.
2.
내장 서버 기반 단일 실행 파일(.jar) 구조도 지원하며 DevOps 및 배포 편의성이 높다.
3.
서버가 없는 배치/통합형 애플리케이션도 Spring으로 충분히 구현 가능하다.

예시

내장 서버 실행 (Spring Boot Web App)
실행을 하게 될 경우 내장 Tomcat 서버가 자동으로 구동되어 브라우저에서 http://localhost:8080 으로 접근 가능함.
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication public class WebApp { public static void main(String[] args) { SpringApplication.run(WebApp.class, args); // 내장 Tomcat 서버 실행 } @RestController static class HelloController { @GetMapping("/") public String hello() { return "Hello from Embedded Tomcat!"; } } }
Java
복사
서버 없는 독립 실행형 (Spring Batch Application)
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.CommandLineRunner; @SpringBootApplication public class BatchApp implements CommandLineRunner { // 서버 실행 아님, 단일 프로세스 실행 public static void main(String[] args) { SpringApplication.run(BatchApp.class, args); } @Override public void run(String... args) { System.out.println("Running batch job... ✅"); // 예: 데이터 처리, 파일 읽기/쓰기, DB 연산 등 } }
Java
복사
⇒ 서버 없이 JVM에서 바로 실행된다. 배치, 데이터 처리, 자동화 업무 같은 백엔드 업무에 적합하다.

원문 3

Spring is open source. It has a large and active community that provides continuous feedback based on a diverse range of real-world use cases. This has helped Spring to successfully evolve over a very long time.

번역

Spring은 오픈 소스 프로젝트이다. 규모가 크고 활발한 커뮤니티를 보유하고 있으며,
다양한 실제 현장의 사용 사례를 바탕으로 지속적인 피드백을 받아왔다.
이 덕분에 오랜 시간 동안 꾸준히 발전하고 진화할 수 있다.

요약

1.
Spring은 오픈 소스 기반의 커뮤니티 중심 프레임워크다.
2.
수많은 실제 기업 및 개발자들의 피드백이 지속적인 개선의 원동력이다.
3.
“Spring이 지금까지 살아남은 이유”는 커뮤니티와 오픈 협력 구조에 있다.

예제 코드 (Spring의 강점): 확장하기 쉬운 구조

// Spring의 확장 가능한 구조 철학을 코드로 표현 import org.springframework.stereotype.Service; interface GreetingService { String greet(); } // 기본 구현체 @Service class EnglishGreetingService implements GreetingService { @Override public String greet() { return "Hello, Spring Community!"; } } // 커뮤니티나 다른 개발자가 쉽게 추가 가능한 구현체 @Service class KoreanGreetingService implements GreetingService { @Override public String greet() { return "안녕하세요, 스프링 커뮤니티!"; } } // 🧩 이를 사용하는 컨트롤러 — 기존 코드를 전혀 수정하지 않아도 새 구현체 사용 가능 import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController class GreetingController { private final GreetingService greetingService; public GreetingController(GreetingService greetingService) { this.greetingService = greetingService; // 스프링이 알아서 적절한 Bean 주입 } @GetMapping("/greet") public String greet() { return greetingService.greet(); } }
Java
복사
GreetingService 인터페이스를 기준으로 여러 구현체를 손쉽게 추가 가능
기존 코드 수정 없이 새로운 기능을 추가할 수 있는 개방-폐쇄 원칙(OCP)
이런 구조 덕분에 Spring은 수많은 커뮤니티 확장을 자연스럽게 흡수할 수 있다.

원문 4 (What We Mean by Spring)

The term "Spring" means different things in different contexts. It can be used to refer to the Spring Framework project itself, which is where it all started. Over time, other Spring projects have been built on top of the Spring Framework. Most often, when people say "Spring", they mean the entire family of projects. This reference documentation focuses on the foundation: the Spring Framework itself.

번역

“Spring”이라는 용어는 문맥에 따라 서로 다른 의미로 사용된다.
가장 기본적으로는, Spring Framework 프로젝트 그 자체를 가리킨다 - 바로 Spring의 출발점이다.
하지만 시간이 지나면서 Spring Framework 위에 여러 다른 Spring 프로젝트들이 구축되었다.
따라서 대부분의 사람들이 “Spring”이라고 말할 때는,
보통 Spring Framework를 포함한 전체 Spring 프로젝트 생태계(family of projects) 를 의미한다.
이 공식 문서는 그중에서도 기초(foundation), 즉 Spring Framework 자체에 초점을 맞춘다.

요약

1.
“Spring”은 상황에 따라 Framework 자체 또는 Spring 전체 생태계를 의미한다.
2.
Spring Framework는 모든 Spring 프로젝트의 기반(foundation) 이다.
3.
이 문서는 Spring Framework 본체에 집중된 자료이다.
┌──────────────────────────────┐ │ Spring Ecosystem │ ← “Spring”이라고 부를 때 가장 넓은 의미 │ ┌──────────────────────────┐ │ │ │ Spring Framework │ │ ← Spring Framework가 핵심(Core) & Foundation │ │ ├─ Core Container │ │ │ │ ├─ Beans & Context │ │ │ │ ├─ AOP, JDBC, Tx │ │ │ │ ├─ Spring MVC / WebFlux │ │ │ └──────────────────────────┘ │ │ │ │ + Spring Boot │ ← 실행 환경 자동화 │ + Spring Data │ ← DB, JPA 등 통합 │ + Spring Security │ ← 인증/인가 │ + Spring Cloud │ ← 마이크로서비스, 분산 시스템 │ + Spring Batch │ ← 대용량 배치 처리 │ + Spring Integration │ ← 시스템 간 연동 └──────────────────────────────┘
Markdown
복사

원문 5 (What We Mean by Spring)

The Spring Framework is divided into modules. Applications can choose which modules they need. At the heart are the modules of the core container, including a configuration model and a dependency injection mechanism. Beyond that, the Spring Framework provides foundational support for different application architectures, including messaging, transactional data and persistence, and web. It also includes the Servlet-based Spring MVC web framework and, in parallel, the Spring WebFlux reactive web framework.

번역

Spring Framework는 여러 개의 모듈(Module)로 구성되어 있다.
애플리케이션은 이 중 필요한 모듈만 선택해서 사용할 수 있다.
가장 중심에는 Core Container(핵심 컨테이너) 모듈이 있다.
여기에는 설정 모델(configuration model)의존성 주입(Dependency Injection, DI)
메커니즘이 포함된다.
그 위에는 다양한 애플리케이션 아키텍처를 지원하기 위한 기본적인 기능들이 있다.
예를 들어 메시징(messaging), 트랜잭션 데이터 및 영속성 관리(persistence), 웹(Web) 지원 등이 있다.
또한, Spring은 Servlet 기반의 Spring MVC 웹 프레임워크
그와 병렬로 작동하는 리액티브(reactive) 기반의 Spring WebFlux 프레임워크를 포함한다.

요약

1.
Spring은 모듈형 구조로, 필요한 기능만 가져다 사용할 수 있다.
2.
중심에는 Core Container (DI, 설정, Bean 관리)가 존재한다.
3.
Spring MVC(동기)Spring WebFlux(비동기/리액티브)가 웹 계층의 양대 축이다.

구조 시각화 + 코드 예시

Spring Framework 전체 구조 개요
Spring Framework Modules │ ├── Core Container (핵심 컨테이너) │ ├─ spring-core → 핵심 유틸, BeanFactory │ ├─ spring-beans → Bean 정의, DI 처리 │ ├─ spring-context → ApplicationContext, 환경 설정 │ └─ spring-expression → SpEL (Spring Expression Language) │ ├── Data Access / Integration (데이터 접근 계층) │ ├─ spring-jdbc → JDBC 추상화 │ ├─ spring-tx → 트랜잭션 관리 │ ├─ spring-orm → JPA, Hibernate 통합 │ ├─ spring-oxm → XML 매핑 │ └─ spring-jms → 메시징 통합 │ ├── Web (웹 계층) │ ├─ spring-web → 기본 Servlet 지원 │ ├─ spring-webmvc → Spring MVC (동기) │ └─ spring-webflux → Spring WebFlux (비동기, Reactive) │ └── Others (부가 기능) ├─ spring-test → 테스트 지원 (JUnit 통합) └─ spring-aop → 관점 지향 프로그래밍 (AOP)
Markdown
복사
Core Container (DI) 동작 예시, 의존성 주입(Dependency Injection)
// Example: Spring Core Container에서의 의존성 주입 기본 구조 import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.GetMapping; // 서비스 계층 @Service class GreetingService { public String getGreeting() { return "Hello from Spring Core Container!"; } } // 컨트롤러 계층 @RestController class GreetingController { private final GreetingService greetingService; // ✅ 의존성 주입: Spring이 GreetingService를 자동으로 주입 @Autowired public GreetingController(GreetingService greetingService) { this.greetingService = greetingService; } @GetMapping("/") public String greet() { return greetingService.getGreeting(); } }
Java
복사
@Autowired : 스프링의 DI(Dependency Injection) 메커니즘
“개발자는 객체를 직접 생성하지 않고, Spring이 관리하는 Bean을 주입받는다.
이 기능이 바로 Spring의 Core Container가 담당하는 핵심 역할이다.

원문 6 (What We Mean by Spring)

A note about modules:
Spring Framework’s jars allow for deployment to the module path (Java Module System).
For use in module-enabled applications, the Spring Framework jars come with Automatic-Module-Name manifest entries which define stable language-level module names (spring.core, spring.context, etc.) independent from jar artifact names.
The jars follow the same naming pattern with - instead of . – for example, spring-core and spring-context.
Of course, Spring Framework’s jars also work fine on the classpath.

번역

모듈 관련 주의사항:
Spring Framework의 JAR 파일들은 Java Module System (JPMS)module path에 배포될 수 있다.
모듈을 사용하는 애플리케이션에서 활용하기 위해, Spring의 각 JAR 파일에는
Automatic-Module-Name 메타데이터가 포함되어 있다.
이 이름들은 JAR 파일의 이름(spring-core.jar, spring-context.jar)과는 별도로,
언어 차원에서 안정적인 모듈 이름(spring.core, spring.context)을 정의한다.
즉, 점(.)이 하이픈(-)으로 바뀐 형태로 JAR 이름과 대응된다.
(spring-core spring.core, spring-context spring.context)
물론, Spring의 JAR 파일들은 여전히 기존처럼 classpath에서도 완벽하게 동작한다.

요약

1.
Java 9부터 등장한 모듈 시스템(JPMS)과 Spring은 완벽히 호환된다.
2.
Spring은 각 JAR에 Automatic-Module-Name을 지정해 안정적인 모듈 이름 관리를 보장한다.
3.
module pathclasspath 모두 지원한다 → 즉, 구버전/신버전 Java 환경 모두에서 동작한다.
이전(Java 8 이하):
클래스 로딩은 오직 classpath 기준 → 충돌 위험, 중복 클래스 로딩 문제 발생.
이후(Java 9 이상):
module-info.java를 통해 명시적 의존성 관리 가능.
예: requires spring.context;
이렇게 선언하면, JAR 이름이 아니라 모듈 이름으로 의존성을 관리하게 됨.

예시 - module.info.java (Spring 기반 모듈 선언 예)

// module-info.java module com.example.app { requires spring.context; requires spring.web; requires spring.beans; }
Java
복사
이렇게 하면 JAR 이름이 아니라 Spring이 지정한 모듈 이름 (spring.context, spring.web)을 기반으로 참조한다.
이 시스템 덕분에 패키지 충돌이나 모듈 간 의존성 혼란이 줄어들고,
Spring을 대형 엔터프라이즈 환경에서 안정적으로 사용 가능하게 해준다.