Codota Logo
ConfigurableBeanFactory.getBeanClassLoader
Code IndexAdd Codota to your IDE (free)

How to use
getBeanClassLoader
method
in
org.springframework.beans.factory.config.ConfigurableBeanFactory

Best Java code snippets using org.springframework.beans.factory.config.ConfigurableBeanFactory.getBeanClassLoader (Showing top 20 results out of 315)

  • Common ways to obtain ConfigurableBeanFactory
private void myMethod () {
ConfigurableBeanFactory c =
  • Codota IconConfigurableApplicationContext configurableApplicationContext;configurableApplicationContext.getBeanFactory()
  • Codota IconDefaultMessageHandlerMethodFactory defaultMessageHandlerMethodFactory;(ConfigurableBeanFactory) defaultMessageHandlerMethodFactory.beanFactory
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

@Override
@Nullable
public ClassLoader getAspectClassLoader() {
  if (this.beanFactory instanceof ConfigurableBeanFactory) {
    return ((ConfigurableBeanFactory) this.beanFactory).getBeanClassLoader();
  }
  else {
    return ClassUtils.getDefaultClassLoader();
  }
}
origin: spring-projects/spring-framework

@Override
@Nullable
public ClassLoader getAspectClassLoader() {
  return (this.beanFactory instanceof ConfigurableBeanFactory ?
      ((ConfigurableBeanFactory) this.beanFactory).getBeanClassLoader() :
      ClassUtils.getDefaultClassLoader());
}
origin: spring-projects/spring-framework

/**
 * Determine the ClassLoader to use for pointcut evaluation.
 */
@Nullable
private ClassLoader determinePointcutClassLoader() {
  if (this.beanFactory instanceof ConfigurableBeanFactory) {
    return ((ConfigurableBeanFactory) this.beanFactory).getBeanClassLoader();
  }
  if (this.pointcutDeclarationScope != null) {
    return this.pointcutDeclarationScope.getClassLoader();
  }
  return ClassUtils.getDefaultClassLoader();
}
origin: spring-projects/spring-framework

@Override
public void setBeanFactory(BeanFactory beanFactory) {
  this.beanFactory = beanFactory;
  if (beanFactory instanceof ConfigurableBeanFactory) {
    ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) beanFactory;
    if (this.beanClassLoader == null) {
      this.beanClassLoader = cbf.getBeanClassLoader();
    }
    this.retrievalMutex = cbf.getSingletonMutex();
  }
}
origin: org.springframework/spring-context

@Override
public void setBeanFactory(BeanFactory beanFactory) {
  this.beanFactory = beanFactory;
  if (beanFactory instanceof ConfigurableBeanFactory) {
    ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) beanFactory;
    if (this.beanClassLoader == null) {
      this.beanClassLoader = cbf.getBeanClassLoader();
    }
    this.retrievalMutex = cbf.getSingletonMutex();
  }
}
origin: spring-projects/spring-framework

    ((ConfigurableBeanFactory) this.beanFactory).getBeanClassLoader() : null);
return pf.getProxy(classLoader);
origin: spring-projects/spring-framework

@Override
public void setBeanFactory(BeanFactory beanFactory) {
  if (!(beanFactory instanceof ConfigurableBeanFactory)) {
    throw new IllegalStateException("Not running in a ConfigurableBeanFactory: " + beanFactory);
  }
  ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) beanFactory;
  this.scopedTargetSource.setBeanFactory(beanFactory);
  ProxyFactory pf = new ProxyFactory();
  pf.copyFrom(this);
  pf.setTargetSource(this.scopedTargetSource);
  Assert.notNull(this.targetBeanName, "Property 'targetBeanName' is required");
  Class<?> beanType = beanFactory.getType(this.targetBeanName);
  if (beanType == null) {
    throw new IllegalStateException("Cannot create scoped proxy for bean '" + this.targetBeanName +
        "': Target type could not be determined at the time of proxy creation.");
  }
  if (!isProxyTargetClass() || beanType.isInterface() || Modifier.isPrivate(beanType.getModifiers())) {
    pf.setInterfaces(ClassUtils.getAllInterfacesForClass(beanType, cbf.getBeanClassLoader()));
  }
  // Add an introduction that implements only the methods on ScopedObject.
  ScopedObject scopedObject = new DefaultScopedObject(cbf, this.scopedTargetSource.getTargetBeanName());
  pf.addAdvice(new DelegatingIntroductionInterceptor(scopedObject));
  // Add the AopInfrastructureBean marker to indicate that the scoped proxy
  // itself is not subject to auto-proxying! Only its target bean is.
  pf.addInterface(AopInfrastructureBean.class);
  this.proxy = pf.getProxy(cbf.getBeanClassLoader());
}
origin: org.springframework/spring-context

    ((ConfigurableBeanFactory) this.beanFactory).getBeanClassLoader() : null);
return pf.getProxy(classLoader);
origin: spring-projects/spring-framework

@Override
public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) {
  Assert.notNull(otherFactory, "BeanFactory must not be null");
  setBeanClassLoader(otherFactory.getBeanClassLoader());
  setCacheBeanMetadata(otherFactory.isCacheBeanMetadata());
  setBeanExpressionResolver(otherFactory.getBeanExpressionResolver());
  setConversionService(otherFactory.getConversionService());
  if (otherFactory instanceof AbstractBeanFactory) {
    AbstractBeanFactory otherAbstractFactory = (AbstractBeanFactory) otherFactory;
    this.propertyEditorRegistrars.addAll(otherAbstractFactory.propertyEditorRegistrars);
    this.customEditors.putAll(otherAbstractFactory.customEditors);
    this.typeConverter = otherAbstractFactory.typeConverter;
    this.beanPostProcessors.addAll(otherAbstractFactory.beanPostProcessors);
    this.hasInstantiationAwareBeanPostProcessors = this.hasInstantiationAwareBeanPostProcessors ||
        otherAbstractFactory.hasInstantiationAwareBeanPostProcessors;
    this.hasDestructionAwareBeanPostProcessors = this.hasDestructionAwareBeanPostProcessors ||
        otherAbstractFactory.hasDestructionAwareBeanPostProcessors;
    this.scopes.putAll(otherAbstractFactory.scopes);
    this.securityContextProvider = otherAbstractFactory.securityContextProvider;
  }
  else {
    setTypeConverter(otherFactory.getTypeConverter());
    String[] otherScopeNames = otherFactory.getRegisteredScopeNames();
    for (String scopeName : otherScopeNames) {
      this.scopes.put(scopeName, otherFactory.getRegisteredScope(scopeName));
    }
  }
}
origin: spring-projects/spring-framework

/**
 * Invoke {@link BeanClassLoaderAware}, {@link BeanFactoryAware},
 * {@link EnvironmentAware}, and {@link ResourceLoaderAware} contracts
 * if implemented by the given object.
 */
public static void invokeAwareMethods(Object parserStrategyBean, Environment environment,
    ResourceLoader resourceLoader, BeanDefinitionRegistry registry) {
  if (parserStrategyBean instanceof Aware) {
    if (parserStrategyBean instanceof BeanClassLoaderAware) {
      ClassLoader classLoader = (registry instanceof ConfigurableBeanFactory ?
          ((ConfigurableBeanFactory) registry).getBeanClassLoader() : resourceLoader.getClassLoader());
      if (classLoader != null) {
        ((BeanClassLoaderAware) parserStrategyBean).setBeanClassLoader(classLoader);
      }
    }
    if (parserStrategyBean instanceof BeanFactoryAware && registry instanceof BeanFactory) {
      ((BeanFactoryAware) parserStrategyBean).setBeanFactory((BeanFactory) registry);
    }
    if (parserStrategyBean instanceof EnvironmentAware) {
      ((EnvironmentAware) parserStrategyBean).setEnvironment(environment);
    }
    if (parserStrategyBean instanceof ResourceLoaderAware) {
      ((ResourceLoaderAware) parserStrategyBean).setResourceLoader(resourceLoader);
    }
  }
}
origin: spring-projects/spring-framework

sec.addPropertyAccessor(new EnvironmentAccessor());
sec.setBeanResolver(new BeanFactoryResolver(evalContext.getBeanFactory()));
sec.setTypeLocator(new StandardTypeLocator(evalContext.getBeanFactory().getBeanClassLoader()));
ConversionService conversionService = evalContext.getBeanFactory().getConversionService();
if (conversionService != null) {
origin: org.springframework/spring-beans

@Override
public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) {
  Assert.notNull(otherFactory, "BeanFactory must not be null");
  setBeanClassLoader(otherFactory.getBeanClassLoader());
  setCacheBeanMetadata(otherFactory.isCacheBeanMetadata());
  setBeanExpressionResolver(otherFactory.getBeanExpressionResolver());
  setConversionService(otherFactory.getConversionService());
  if (otherFactory instanceof AbstractBeanFactory) {
    AbstractBeanFactory otherAbstractFactory = (AbstractBeanFactory) otherFactory;
    this.propertyEditorRegistrars.addAll(otherAbstractFactory.propertyEditorRegistrars);
    this.customEditors.putAll(otherAbstractFactory.customEditors);
    this.typeConverter = otherAbstractFactory.typeConverter;
    this.beanPostProcessors.addAll(otherAbstractFactory.beanPostProcessors);
    this.hasInstantiationAwareBeanPostProcessors = this.hasInstantiationAwareBeanPostProcessors ||
        otherAbstractFactory.hasInstantiationAwareBeanPostProcessors;
    this.hasDestructionAwareBeanPostProcessors = this.hasDestructionAwareBeanPostProcessors ||
        otherAbstractFactory.hasDestructionAwareBeanPostProcessors;
    this.scopes.putAll(otherAbstractFactory.scopes);
    this.securityContextProvider = otherAbstractFactory.securityContextProvider;
  }
  else {
    setTypeConverter(otherFactory.getTypeConverter());
    String[] otherScopeNames = otherFactory.getRegisteredScopeNames();
    for (String scopeName : otherScopeNames) {
      this.scopes.put(scopeName, otherFactory.getRegisteredScope(scopeName));
    }
  }
}
origin: org.springframework/spring-context

/**
 * Invoke {@link BeanClassLoaderAware}, {@link BeanFactoryAware},
 * {@link EnvironmentAware}, and {@link ResourceLoaderAware} contracts
 * if implemented by the given object.
 */
public static void invokeAwareMethods(Object parserStrategyBean, Environment environment,
    ResourceLoader resourceLoader, BeanDefinitionRegistry registry) {
  if (parserStrategyBean instanceof Aware) {
    if (parserStrategyBean instanceof BeanClassLoaderAware) {
      ClassLoader classLoader = (registry instanceof ConfigurableBeanFactory ?
          ((ConfigurableBeanFactory) registry).getBeanClassLoader() : resourceLoader.getClassLoader());
      if (classLoader != null) {
        ((BeanClassLoaderAware) parserStrategyBean).setBeanClassLoader(classLoader);
      }
    }
    if (parserStrategyBean instanceof BeanFactoryAware && registry instanceof BeanFactory) {
      ((BeanFactoryAware) parserStrategyBean).setBeanFactory((BeanFactory) registry);
    }
    if (parserStrategyBean instanceof EnvironmentAware) {
      ((EnvironmentAware) parserStrategyBean).setEnvironment(environment);
    }
    if (parserStrategyBean instanceof ResourceLoaderAware) {
      ((ResourceLoaderAware) parserStrategyBean).setResourceLoader(resourceLoader);
    }
  }
}
origin: org.springframework/spring-context

sec.addPropertyAccessor(new EnvironmentAccessor());
sec.setBeanResolver(new BeanFactoryResolver(evalContext.getBeanFactory()));
sec.setTypeLocator(new StandardTypeLocator(evalContext.getBeanFactory().getBeanClassLoader()));
ConversionService conversionService = evalContext.getBeanFactory().getConversionService();
if (conversionService != null) {
origin: spring-projects/spring-framework

  /**
   * Create an enhanced subclass of the bean class for the provided bean
   * definition, using CGLIB.
   */
  private Class<?> createEnhancedSubclass(RootBeanDefinition beanDefinition) {
    Enhancer enhancer = new Enhancer();
    enhancer.setSuperclass(beanDefinition.getBeanClass());
    enhancer.setNamingPolicy(SpringNamingPolicy.INSTANCE);
    if (this.owner instanceof ConfigurableBeanFactory) {
      ClassLoader cl = ((ConfigurableBeanFactory) this.owner).getBeanClassLoader();
      enhancer.setStrategy(new ClassLoaderAwareGeneratorStrategy(cl));
    }
    enhancer.setCallbackFilter(new MethodOverrideCallbackFilter(beanDefinition));
    enhancer.setCallbackTypes(CALLBACK_TYPES);
    return enhancer.createClass();
  }
}
origin: org.springframework/spring-beans

  /**
   * Create an enhanced subclass of the bean class for the provided bean
   * definition, using CGLIB.
   */
  private Class<?> createEnhancedSubclass(RootBeanDefinition beanDefinition) {
    Enhancer enhancer = new Enhancer();
    enhancer.setSuperclass(beanDefinition.getBeanClass());
    enhancer.setNamingPolicy(SpringNamingPolicy.INSTANCE);
    if (this.owner instanceof ConfigurableBeanFactory) {
      ClassLoader cl = ((ConfigurableBeanFactory) this.owner).getBeanClassLoader();
      enhancer.setStrategy(new ClassLoaderAwareGeneratorStrategy(cl));
    }
    enhancer.setCallbackFilter(new MethodOverrideCallbackFilter(beanDefinition));
    enhancer.setCallbackTypes(CALLBACK_TYPES);
    return enhancer.createClass();
  }
}
origin: camunda/camunda-bpm-platform

public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) {
  Assert.notNull(otherFactory, "BeanFactory must not be null");
  setBeanClassLoader(otherFactory.getBeanClassLoader());
  setCacheBeanMetadata(otherFactory.isCacheBeanMetadata());
  setBeanExpressionResolver(otherFactory.getBeanExpressionResolver());
  if (otherFactory instanceof AbstractBeanFactory) {
    AbstractBeanFactory otherAbstractFactory = (AbstractBeanFactory) otherFactory;
    this.customEditors.putAll(otherAbstractFactory.customEditors);
    this.propertyEditorRegistrars.addAll(otherAbstractFactory.propertyEditorRegistrars);
    this.beanPostProcessors.addAll(otherAbstractFactory.beanPostProcessors);
    this.hasInstantiationAwareBeanPostProcessors = this.hasInstantiationAwareBeanPostProcessors ||
        otherAbstractFactory.hasInstantiationAwareBeanPostProcessors;
    this.hasDestructionAwareBeanPostProcessors = this.hasDestructionAwareBeanPostProcessors ||
        otherAbstractFactory.hasDestructionAwareBeanPostProcessors;
    this.scopes.putAll(otherAbstractFactory.scopes);
    this.securityContextProvider = otherAbstractFactory.securityContextProvider;
  }
  else {
    setTypeConverter(otherFactory.getTypeConverter());
  }
}
origin: spring-projects/spring-integration

private static void invokeAwareMethods(Object parserStrategyBean, Environment environment,
    ResourceLoader resourceLoader, BeanDefinitionRegistry registry) {
  if (parserStrategyBean instanceof Aware) {
    if (parserStrategyBean instanceof BeanClassLoaderAware) {
      ClassLoader classLoader = (registry instanceof ConfigurableBeanFactory ?
          ((ConfigurableBeanFactory) registry).getBeanClassLoader() : resourceLoader.getClassLoader());
      if (classLoader != null) {
        ((BeanClassLoaderAware) parserStrategyBean).setBeanClassLoader(classLoader);
      }
    }
    if (parserStrategyBean instanceof BeanFactoryAware && registry instanceof BeanFactory) {
      ((BeanFactoryAware) parserStrategyBean).setBeanFactory((BeanFactory) registry);
    }
    if (parserStrategyBean instanceof EnvironmentAware) {
      ((EnvironmentAware) parserStrategyBean).setEnvironment(environment);
    }
    if (parserStrategyBean instanceof ResourceLoaderAware) {
      ((ResourceLoaderAware) parserStrategyBean).setResourceLoader(resourceLoader);
    }
  }
}
origin: apache/servicemix-bundles

/**
 * Determine the ClassLoader to use for pointcut evaluation.
 */
private ClassLoader determinePointcutClassLoader() {
  if (this.beanFactory instanceof ConfigurableBeanFactory) {
    return ((ConfigurableBeanFactory) this.beanFactory).getBeanClassLoader();
  }
  if (this.pointcutDeclarationScope != null) {
    return this.pointcutDeclarationScope.getClassLoader();
  }
  return ClassUtils.getDefaultClassLoader();
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-aop

@Override
@Nullable
public ClassLoader getAspectClassLoader() {
  return (this.beanFactory instanceof ConfigurableBeanFactory ?
      ((ConfigurableBeanFactory) this.beanFactory).getBeanClassLoader() :
      ClassUtils.getDefaultClassLoader());
}
org.springframework.beans.factory.configConfigurableBeanFactorygetBeanClassLoader

Javadoc

Return this factory's class loader for loading bean classes.

Popular methods of ConfigurableBeanFactory

  • resolveEmbeddedValue
    Resolve the given embedded value, e.g. an annotation attribute.
  • getBeanExpressionResolver
    Return the resolution strategy for expressions in bean definition values.
  • getBean
  • registerSingleton
    Register the given existing object as singleton in the bean factory, under the given bean name.The g
  • getTypeConverter
    Obtain a type converter as used by this BeanFactory. This may be a fresh instance for each call, sin
  • containsBean
  • getConversionService
    Return the associated ConversionService, if any.
  • getMergedBeanDefinition
    Return a merged BeanDefinition for the given bean name, merging a child bean definition with its par
  • isCurrentlyInCreation
    Determine whether the specified bean is currently in creation.
  • getSingletonMutex
  • destroySingletons
    Destroy all cached singletons in this factory. To be called on shutdown of a factory.
  • getSingletonNames
  • destroySingletons,
  • getSingletonNames,
  • registerDependentBean,
  • containsSingleton,
  • destroyBean,
  • isFactoryBean,
  • isSingleton,
  • registerAlias,
  • addBeanPostProcessor

Popular in Java

  • Start an intent from android
  • putExtra (Intent)
  • compareTo (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • JList (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now