전체 글(386)
-
Spring IoC
Spring의 IoC(Inverse of Control) 컨테이너에 대해 다룹니다.Section SummaryIntroduction to the Spring IoC Container and Beans, Container OverviewBean OverviewDependenciesBean ScopesCustomizing the Nature of a BeanBean Definition InheritanceContainer Extension PointsAnnotation-based Container ConfigurationClasspath Scanning and Managed ComponentsUsing JSR 330 Standard AnnotationsJava-based Container Configurat..
2024.11.15 -
The BeanFactory API
BeanFactory API는 Spring의 IoC 기능의 기본 기반을 제공합니다. 해당 특정 인터페이스들은 주로 Spring의 다른 부분 및 관련 타사 프레임워크와의 통합에서 사용되며, DefaultListableBeanFactory 구현은 상위 수준의 GenericApplicationContext 컨테이너 내에서 key delegate 로 작동합니다.BeanFactory와 관련된 인터페이스(BeanFactoryAware, InitializingBean, DisposableBean 등)는 다른 프레임워크 구성 요소와의 중요한 통합 지점을 제공합니다. 애노테이션이나 심지어 리플렉션도 요구하지 않으므로 컨테이너와 구성 요소 간의 매우 효율적인 상호작용이 가능합니다. 애플리케이션 레벨의 빈은 동일한 콜백 인..
2024.11.15 -
Additional Capabilities of the ApplicationContext
서론에서 논의한 바와 같이, org.springframework.beans.factory 패키지는 프로그램 방식으로도 빈을 관리하고 조작할 수 있는 기본 기능을 제공합니다. org.springframework.context 패키지는 애플리케이션 프레임워크 지향 스타일로 추가 기능을 제공하기 위해 다른 인터페이스를 확장하는 것 외에도, BeanFactory 인터페이스를 확장한 ApplicationContext 인터페이스를 추가합니다. 많은 사람들이 ApplicationContext를 완전히 선언적으로 사용하여 프로그램 방식으로 생성하지 않고, ContextLoader 같은 지원 클래스를 사용하여 Jakarta EE 웹 애플리케이션의 일반적인 시작 프로세스의 일부로 자동으로 ApplicationContext..
2024.11.15 -
Registering a LoadTimeWeaver
LoadTimeWeaver는 Spring에서 클래스가 Java 가상 머신(JVM)에 로드될 때 동적으로 변환하는 데 사용됩니다.로드 타임 위빙을 활성화하려면, 다음 예제와 같이 @Configuration 클래스 중 하나에 @EnableLoadTimeWeaving을 추가할 수 있습니다: @Configuration@EnableLoadTimeWeavingpublic class AppConfig {} 또한, XML 설정에서는 context:load-time-weaver 요소를 사용할 수 있습니다: ApplicationContext에 로드 타임 위버가 구성되면, 해당 ApplicationContext 내의 모든 빈은 LoadTimeWeaverAware를 구현하여 로드 타임 위버 인스턴스에 대한 참조를 받을 수 ..
2024.11.15 -
Environment Abstraction
Environment 인터페이스는 애플리케이션 환경의 두 가지 주요 측면인 profile과 properties을 모델링하는 컨테이너에 통합된 추상화입니다. profile은 지정된 profile이 활성 상태일 때만 컨테이너에 등록할 논리적 빈 정의 그룹입니다. 빈은 XML이나 애노테이션으로 정의되든 profile에 할당될 수 있습니다. Environment 객체의 profile과 관련된 역할은 현재 활성화된 profile이 무엇인지, 디폴트로 활성화되어야 할 profile이 무엇인지를 결정하는 것입니다. properties은 거의 모든 애플리케이션에서 중요한 역할을 하며, properties 파일, JVM 시스템 속성, 시스템 환경 변수, JNDI, 서블릿 컨텍스트 파라미터, 임시 Properties 객체..
2024.11.14 -
Using @PostConstruct and @PreDestory
CommonAnnotationBeanPostProcessor는 @Resource 애노테이션뿐만 아니라 JSR-250 라이프사이클 애노테이션인 jakarta.annotation.PostConstruct와 jakarta.annotation.PreDestroy도 인식합니다. Spring 2.5에서 도입된 이러한 애노테이션 지원은 initialization callbacks과 destruction callbacks에서 설명된 라이프사이클 콜백 메커니즘에 대한 대안을 제공합니다. CommonAnnotationBeanPostProcessor가 Spring ApplicationContext 내에 등록되어 있으면, 이러한 애노테이션이 부여된 메서드는 해당 Spring 라이프사이클 인터페이스 메서드나 명시적으로 선언된 ..
2024.11.14