Package org.springframework.instrument.classloading

Examples of org.springframework.instrument.classloading.LoadTimeWeaver


  @Test
  public void enableLTW_withAjWeavingDisabled() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(EnableLTWConfig_withAjWeavingDisabled.class);
    ctx.refresh();
    LoadTimeWeaver loadTimeWeaver = ctx.getBean("loadTimeWeaver", LoadTimeWeaver.class);
    verifyZeroInteractions(loadTimeWeaver);
  }
View Full Code Here


  @Test
  public void enableLTW_withAjWeavingAutodetect() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(EnableLTWConfig_withAjWeavingAutodetect.class);
    ctx.refresh();
    LoadTimeWeaver loadTimeWeaver = ctx.getBean("loadTimeWeaver", LoadTimeWeaver.class);
    // no expectations -> a class file transformer should NOT be added
    // because no META-INF/aop.xml is present on the classpath
    verifyZeroInteractions(loadTimeWeaver);
  }
View Full Code Here

  @Test
  public void enableLTW_withAjWeavingEnabled() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(EnableLTWConfig_withAjWeavingEnabled.class);
    ctx.refresh();
    LoadTimeWeaver loadTimeWeaver = ctx.getBean("loadTimeWeaver", LoadTimeWeaver.class);
    verify(loadTimeWeaver).addTransformer(isA(ClassFileTransformer.class));
  }
View Full Code Here

    return HIGHEST_PRECEDENCE;
  }


  public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    LoadTimeWeaver weaverToUse = this.loadTimeWeaver;
    if (weaverToUse == null) {
      if (InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
        weaverToUse = new InstrumentationLoadTimeWeaver(this.beanClassLoader);
      }
      else {
        throw new IllegalStateException("No LoadTimeWeaver available");
      }
    }
    weaverToUse.addTransformer(new AspectJClassBypassingClassFileTransformer(
          new ClassPreProcessorAgentAdapter()));
  }
View Full Code Here

  }


  public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    if (bean instanceof LoadTimeWeaverAware) {
      LoadTimeWeaver ltw = this.loadTimeWeaver;
      if (ltw == null) {
        Assert.state(this.beanFactory != null,
            "BeanFactory required if no LoadTimeWeaver explicitly specified");
        ltw = this.beanFactory.getBean(
            ConfigurableApplicationContext.LOAD_TIME_WEAVER_BEAN_NAME, LoadTimeWeaver.class);
View Full Code Here

  private LoadTimeWeaver loadTimeWeaver;


  public void setBeanClassLoader(ClassLoader classLoader) {
    LoadTimeWeaver serverSpecificLoadTimeWeaver = createServerSpecificLoadTimeWeaver(classLoader);
    if (serverSpecificLoadTimeWeaver != null) {
      if (logger.isInfoEnabled()) {
        logger.info("Determined server-specific load-time weaver: " +
            serverSpecificLoadTimeWeaver.getClass().getName());
      }
      this.loadTimeWeaver = serverSpecificLoadTimeWeaver;
    }
    else if (InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
      logger.info("Found Spring's JVM agent for instrumentation");
View Full Code Here

TOP

Related Classes of org.springframework.instrument.classloading.LoadTimeWeaver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.