Registering a LoadTimeWeaver

Dev.Hammy·2024년 2월 24일
0

LoadTimeWeaver는 클래스가 JVM(Java Virtual Machine)에 로드될 때 클래스를 동적으로 변환(transform)하기 위해 Spring에서 사용됩니다.

load-time 위빙을 활성화하려면 다음 예제와 같이 @Configuration 클래스 중 하나에 @EnableLoadTimeWeaving을 추가하면 됩니다.

@Configuration
@EnableLoadTimeWeaving
public class AppConfig {
}

또는 XML 구성의 경우 context:load-time-weaver 요소를 사용할 수 있습니다.

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

ApplicationContext에 대해 구성(configured)되면 해당 ApplicationContext 내의 모든 Bean은 LoadTimeWeaverAware를 구현할 수 있으며 이를 통해 load-time 위버 인스턴스에 대한 참조(reference)를 수신할 수 있습니다. 이는 JPA 클래스 변환을 위해 load-time 위빙이 필요할 수 있는 Spring의 JPA 지원과 결합하여 특히 유용합니다. 자세한 내용은 LocalContainerEntityManagerFactoryBean javadoc를 참조하세요. AspectJ load-time 위빙에 대한 자세한 내용은 Spring Framework에서 AspectJ를 사용한 load-time 위빙을 참조하세요.

0개의 댓글