本文整理汇总了Java中org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver类的典型用法代码示例。如果您正苦于以下问题:Java InstrumentationLoadTimeWeaver类的具体用法?Java InstrumentationLoadTimeWeaver怎么用?Java InstrumentationLoadTimeWeaver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InstrumentationLoadTimeWeaver类属于org.springframework.instrument.classloading包,在下文中一共展示了InstrumentationLoadTimeWeaver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setBeanClassLoader
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
@Override
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");
this.loadTimeWeaver = new InstrumentationLoadTimeWeaver(classLoader);
}
else {
try {
this.loadTimeWeaver = new ReflectiveLoadTimeWeaver(classLoader);
logger.info("Using a reflective load-time weaver for class loader: " +
this.loadTimeWeaver.getInstrumentableClassLoader().getClass().getName());
}
catch (IllegalStateException ex) {
throw new IllegalStateException(ex.getMessage() + " Specify a custom LoadTimeWeaver or start your " +
"Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar");
}
}
}
示例2: setBeanClassLoader
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
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");
this.loadTimeWeaver = new InstrumentationLoadTimeWeaver(classLoader);
}
else {
try {
this.loadTimeWeaver = new ReflectiveLoadTimeWeaver(classLoader);
logger.info("Using a reflective load-time weaver for class loader: " +
this.loadTimeWeaver.getInstrumentableClassLoader().getClass().getName());
}
catch (IllegalStateException ex) {
throw new IllegalStateException(ex.getMessage() + " Specify a custom LoadTimeWeaver or start your " +
"Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar");
}
}
}
示例3: destroy
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
@Override
public void destroy() {
if (this.loadTimeWeaver instanceof InstrumentationLoadTimeWeaver) {
logger.info("Removing all registered transformers for class loader: " +
this.loadTimeWeaver.getInstrumentableClassLoader().getClass().getName());
((InstrumentationLoadTimeWeaver) this.loadTimeWeaver).removeTransformers();
}
}
示例4: afterPropertiesSet
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
@Override
public void afterPropertiesSet() {
if (this.loadTimeWeaver == null && InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
this.loadTimeWeaver = new InstrumentationLoadTimeWeaver(this.resourcePatternResolver.getClassLoader());
}
preparePersistenceUnitInfos();
}
示例5: createEntityManagerFactoryBean
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
protected LocalContainerEntityManagerFactoryBean createEntityManagerFactoryBean(
String persistenceXml, Properties props, String entityManagerName) throws Exception {
// This will be set by DummyPersistenceProvider
actualPui = null;
actualProps = null;
LocalContainerEntityManagerFactoryBean containerEmfb = new LocalContainerEntityManagerFactoryBean();
containerEmfb.setPersistenceUnitName(entityManagerName);
containerEmfb.setPersistenceProviderClass(DummyContainerPersistenceProvider.class);
if (props != null) {
containerEmfb.setJpaProperties(props);
}
containerEmfb.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver());
containerEmfb.setPersistenceXmlLocation(persistenceXml);
containerEmfb.afterPropertiesSet();
assertEquals(entityManagerName, actualPui.getPersistenceUnitName());
if (props != null) {
assertEquals(props, actualProps);
}
//checkInvariants(containerEmfb);
return containerEmfb;
//containerEmfb.destroy();
//emfMc.verify();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:30,代码来源:LocalContainerEntityManagerFactoryBeanTests.java
示例6: initialize
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
public static void initialize(final String args, final Instrumentation inst) {
if (InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
throw new IllegalStateException(
"Instrumentation is already available, the agent should have been loaded already!");
}
InstrumentationSavingAgent.premain(args, inst);
}
示例7: main
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
public static void main(String[] args) {
DynamicInstrumentationLoader.waitForInitialized();
DynamicInstrumentationLoader.initLoadTimeWeavingContext();
if (!InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
throw new IllegalStateException("Instrumentation not available!");
} else {
System.out.println("Instrumentation available!");
}
}
示例8: destroy
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
public void destroy() {
if (this.loadTimeWeaver instanceof InstrumentationLoadTimeWeaver) {
logger.info("Removing all registered transformers for class loader: " +
this.loadTimeWeaver.getInstrumentableClassLoader().getClass().getName());
((InstrumentationLoadTimeWeaver) this.loadTimeWeaver).removeTransformers();
}
}
示例9: getLoadTimeWeaver
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
public LoadTimeWeaver getLoadTimeWeaver() {
return new InstrumentationLoadTimeWeaver();
}
示例10: loadTimeWeaver
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
@Bean
public LoadTimeWeaver loadTimeWeaver() {
return new InstrumentationLoadTimeWeaver();
}
示例11: detectWeavingMode
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
private String detectWeavingMode() {
LOGGER.info("PersistenceConfiguration.detectWeavingMode()");
return InstrumentationLoadTimeWeaver.isInstrumentationAvailable() ? "true" : "static";
}
示例12: isInitialized
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
public static boolean isInitialized() {
return InstrumentationLoadTimeWeaver.isInstrumentationAvailable();
}
示例13: instrumentationLoadTimeWeaver
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
@Bean
public LoadTimeWeaver instrumentationLoadTimeWeaver() {
return new InstrumentationLoadTimeWeaver();
}
示例14: afterPropertiesSet
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
public void afterPropertiesSet() {
if (this.loadTimeWeaver == null && InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
this.loadTimeWeaver = new InstrumentationLoadTimeWeaver(this.resourcePatternResolver.getClassLoader());
}
preparePersistenceUnitInfos();
}
示例15: shouldUseShadowLoader
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; //导入依赖的package包/类
/**
* Subclasses should override this method if they wish to disable shadow class loading.
* <p>The default implementation deactivates shadow class loading if Spring's
* InstrumentationSavingAgent has been configured on VM startup.
*/
protected boolean shouldUseShadowLoader() {
return !InstrumentationLoadTimeWeaver.isInstrumentationAvailable();
}