Home [Spring] 1.14. Registering a LoadTimeWeaver
Post
Cancel

[Spring] 1.14. Registering a LoadTimeWeaver

1.14. Registering a LoadTimeWeaver

The LoadTimeWeaver is used by Spring to dynamically transform classes as they are loaded into the Java virtual machine (JVM).

  • LoadTimeWeaver는 Spring Java 가상 머신(JVM)에 로딩될 때 클래스를 동적으로 변환하는 데 사용한다.

To enable load-time weaving, you can add the @EnableLoadTimeWeaving to one of your @Configuration classes, as the following example shows:

  • load-time weaving를 사용하려면 다음 예에서 볼 수 있듯이 @EnableLoadTimeWeaving@Configuration 클래스 중 하나에 추가하십시오.
1
2
3
@Configuration
@EnableLoadTimeWeaving
class AppConfig

Alternatively, for XML configuration, you can use the context:load-time-weaver element:

  • 또는 XML 구성의 경우 context:load-time-weaver 요소를 사용하십시오.
1
2
3
<beans>
    <context:load-time-weaver/>
</beans>

Once configured for the ApplicationContext, any bean within that ApplicationContext may implement LoadTimeWeaverAware, thereby receiving a reference to the load-time weaver instance. This is particularly useful in combination with Spring’s JPA support where load-time weaving may be necessary for JPA class transformation. Consult the LocalContainerEntityManagerFactoryBean javadoc for more detail. For more on AspectJ load-time weaving, see Load-time Weaving with AspectJ in the Spring Framework.

  • ApplicationContext에 대해 구성되면 해당 ApplicationContext 내의 모든 bean은 LoadTimeWeaverAware를 구현하여 load-time weaver instance에 대한 참조를 수신할 수 있다.
  • 이것은 특히 JPA class transformation을 위해 load-time weaving이 필요할 수 있는 Spring’s JPA support와 함께 유용하다.
  • 자세한 내용은 LocalContainerEntityManagerFactoryBean javadoc을 참조하십시오.
  • See Load-time Weaving with AspectJ in the Spring Framework.

References

This post is licensed under CC BY 4.0 by the author.

[Spring] 1.13.4. Placeholder Resolution in Statements

[Spring] 1.15. Additional Capabilities of the ApplicationContext