1 16 17 package org.springframework.instrument.classloading; 18 19 import java.lang.instrument.ClassFileTransformer ; 20 21 import org.springframework.core.OverridingClassLoader; 22 23 31 public class SimpleInstrumentableClassLoader extends OverridingClassLoader { 32 33 private final WeavingTransformer weavingTransformer; 34 35 36 41 public SimpleInstrumentableClassLoader(ClassLoader parent) { 42 super(parent); 43 this.weavingTransformer = new WeavingTransformer(parent); 44 } 45 46 47 51 public void addTransformer(ClassFileTransformer transformer) { 52 this.weavingTransformer.addTransformer(transformer); 53 } 54 55 56 @Override 57 protected byte[] transformIfNecessary(String name, byte[] bytes) { 58 return this.weavingTransformer.transformIfNecessary(name, bytes); 59 } 60 61 } 62 | Popular Tags |