· 약 3분 AI assisted
Registering a LoadTimeWeaver
Spring IoC Container (24편)
- Spring Framework Overview
- Core Technologies
- Container Overview
- Bean Overview
- Dependencies and Configuration in Detail
- Using depends-on
- Lazy-initialized Beans
- Method Injection
- Bean Scopes
- Customizing the Nature of a Bean
- Bean Definition Inheritance
- Container Extension Points
- Annotation-based Container Configuration
- Classpath Scanning and Managed Components
- Using JSR-330 Standard Annotations
- Basic Concepts: @Bean and @Configuration
- Using the @Bean Annotation
- Using the @Configuration annotation
- Instantiating the Spring Container by Using AnnotationConfigApplicationContext
- Autowiring Collaborators
- Environment Abstraction
- Registering a LoadTimeWeaver
- Additional Capabilities of the ApplicationContext
- The BeanFactory API
전문 번역
Registering a LoadTimeWeaver (LoadTimeWeaver 등록)
LoadTimeWeaver는 Spring이 클래스가 Java 가상 머신(JVM)에 로드될 때 동적으로 변환하기 위해 사용된다.
로드타임 위빙을 활성화하려면, 다음 예제와 같이 @Configuration 클래스 중 하나에 @EnableLoadTimeWeaving을 추가할 수 있다:
Java:
@Configuration@EnableLoadTimeWeavingpublic class AppConfig {}Kotlin:
@Configuration@EnableLoadTimeWeavingclass AppConfig또는 XML 설정의 경우, context:load-time-weaver 요소를 사용할 수 있다:
<beans> <context:load-time-weaver/></beans>ApplicationContext에 대해 한번 설정되면, 해당 ApplicationContext 내의 모든 빈은 LoadTimeWeaverAware를 구현할 수 있으며, 이를 통해 로드타임 위버 인스턴스에 대한 참조를 받을 수 있다. 이는 특히 Spring의 JPA 지원과 결합될 때 유용한데, JPA 클래스 변환에 로드타임 위빙이 필요할 수 있기 때문이다. 더 자세한 내용은 LocalContainerEntityManagerFactoryBean javadoc을 참조하라. AspectJ 로드타임 위빙에 대한 자세한 내용은 Load-time Weaving with AspectJ in the Spring Framework를 참조하라.