1.14 LoadTimeWeaver 등록 by ks

LoadTimeWeaver는 JVM으로 로드되어 동적으로 클래스를 변환하는데 사용된다.

load-time weaving이 가능하도록 하기 위해, @EnableLoadTimeWeaving을 @Configuration 클래스 중 하나에 더한다.

@Configuration
@EnableLoadTimeWeaving
public class AppConfig {
}

대안적으로, XML configuration에선 context:load-time-weaver를 쓴다.

<beans>
    <context:load-time-weaver/>
</beans>

ApplicationContext를 한번 등록하고, ApplicationContext안의 빈들은 LoadTimeWeaverAware를 확장할지도 모르므로, load-time weaver 인스턴스로 레퍼런스를 받는다. 이는 부분적으로 JPA 클래스 변환에 필요할 load-time weaving하는 Spring’s JPA support 와 조합하는데 유용하다. LocalContainerEntityManagerFactoryBean 의 javadoc과 상세사항을 확인해보자. 심층적으로 AspectJ load-time weaving은 Load-time Weaving with AspectJ in the Spring Framework. 를 확인해보자.

Last updated