congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ConfigurableBeanFactory.isCurrentlyInCreation
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: spring-projects/spring-framework

/**
 * Check the BeanFactory to see whether the bean named <var>beanName</var> already
 * exists. Accounts for the fact that the requested bean may be "in creation", i.e.:
 * we're in the middle of servicing the initial request for this bean. From an enhanced
 * factory method's perspective, this means that the bean does not actually yet exist,
 * and that it is now our job to create it for the first time by executing the logic
 * in the corresponding factory method.
 * <p>Said another way, this check repurposes
 * {@link ConfigurableBeanFactory#isCurrentlyInCreation(String)} to determine whether
 * the container is calling this method or the user is calling this method.
 * @param beanName name of bean to check for
 * @return whether <var>beanName</var> already exists in the factory
 */
private boolean factoryContainsBean(ConfigurableBeanFactory beanFactory, String beanName) {
  return (beanFactory.containsBean(beanName) && !beanFactory.isCurrentlyInCreation(beanName));
}
origin: spring-projects/spring-framework

/**
 * Resolves the specified interceptor names to Advisor objects.
 * @see #setInterceptorNames
 */
private Advisor[] resolveInterceptorNames() {
  BeanFactory bf = this.beanFactory;
  ConfigurableBeanFactory cbf = (bf instanceof ConfigurableBeanFactory ? (ConfigurableBeanFactory) bf : null);
  List<Advisor> advisors = new ArrayList<>();
  for (String beanName : this.interceptorNames) {
    if (cbf == null || !cbf.isCurrentlyInCreation(beanName)) {
      Assert.state(bf != null, "BeanFactory required for resolving interceptor names");
      Object next = bf.getBean(beanName);
      advisors.add(this.advisorAdapterRegistry.wrap(next));
    }
  }
  return advisors.toArray(new Advisor[0]);
}
origin: spring-projects/spring-framework

@Override
@Nullable
public Object getObject() throws BeansException {
  BeanWrapper target = this.targetBeanWrapper;
  if (target != null) {
    if (logger.isWarnEnabled() && this.targetBeanName != null &&
        this.beanFactory instanceof ConfigurableBeanFactory &&
        ((ConfigurableBeanFactory) this.beanFactory).isCurrentlyInCreation(this.targetBeanName)) {
      logger.warn("Target bean '" + this.targetBeanName + "' is still in creation due to a circular " +
          "reference - obtained value for property '" + this.propertyPath + "' may be outdated!");
    }
  }
  else {
    // Fetch prototype target bean...
    Assert.state(this.beanFactory != null, "No BeanFactory available");
    Assert.state(this.targetBeanName != null, "No target bean name specified");
    Object bean = this.beanFactory.getBean(this.targetBeanName);
    target = PropertyAccessorFactory.forBeanPropertyAccess(bean);
  }
  Assert.state(this.propertyPath != null, "No property path specified");
  return target.getPropertyValue(this.propertyPath);
}
origin: org.springframework/spring-context

/**
 * Check the BeanFactory to see whether the bean named <var>beanName</var> already
 * exists. Accounts for the fact that the requested bean may be "in creation", i.e.:
 * we're in the middle of servicing the initial request for this bean. From an enhanced
 * factory method's perspective, this means that the bean does not actually yet exist,
 * and that it is now our job to create it for the first time by executing the logic
 * in the corresponding factory method.
 * <p>Said another way, this check repurposes
 * {@link ConfigurableBeanFactory#isCurrentlyInCreation(String)} to determine whether
 * the container is calling this method or the user is calling this method.
 * @param beanName name of bean to check for
 * @return whether <var>beanName</var> already exists in the factory
 */
private boolean factoryContainsBean(ConfigurableBeanFactory beanFactory, String beanName) {
  return (beanFactory.containsBean(beanName) && !beanFactory.isCurrentlyInCreation(beanName));
}
origin: org.springframework/spring-beans

@Override
@Nullable
public Object getObject() throws BeansException {
  BeanWrapper target = this.targetBeanWrapper;
  if (target != null) {
    if (logger.isWarnEnabled() && this.targetBeanName != null &&
        this.beanFactory instanceof ConfigurableBeanFactory &&
        ((ConfigurableBeanFactory) this.beanFactory).isCurrentlyInCreation(this.targetBeanName)) {
      logger.warn("Target bean '" + this.targetBeanName + "' is still in creation due to a circular " +
          "reference - obtained value for property '" + this.propertyPath + "' may be outdated!");
    }
  }
  else {
    // Fetch prototype target bean...
    Assert.state(this.beanFactory != null, "No BeanFactory available");
    Assert.state(this.targetBeanName != null, "No target bean name specified");
    Object bean = this.beanFactory.getBean(this.targetBeanName);
    target = PropertyAccessorFactory.forBeanPropertyAccess(bean);
  }
  Assert.state(this.propertyPath != null, "No property path specified");
  return target.getPropertyValue(this.propertyPath);
}
origin: spring-projects/spring-framework

String msg = "Factory method '" + factoryMethod.getName() + "' threw exception";
if (bd.getFactoryBeanName() != null && owner instanceof ConfigurableBeanFactory &&
    ((ConfigurableBeanFactory) owner).isCurrentlyInCreation(bd.getFactoryBeanName())) {
  msg = "Circular reference involving containing bean '" + bd.getFactoryBeanName() + "' - consider " +
      "declaring the factory method as static for independence from its containing instance. " + msg;
origin: spring-projects/spring-framework

boolean alreadyInCreation = beanFactory.isCurrentlyInCreation(beanName);
try {
  if (alreadyInCreation) {
origin: spring-projects/spring-framework

if (beanFactory.isCurrentlyInCreation(scopedBeanName)) {
  beanName = scopedBeanName;
origin: org.springframework/spring-context

boolean alreadyInCreation = beanFactory.isCurrentlyInCreation(beanName);
try {
  if (alreadyInCreation) {
origin: org.springframework/spring-beans

String msg = "Factory method '" + factoryMethod.getName() + "' threw exception";
if (bd.getFactoryBeanName() != null && owner instanceof ConfigurableBeanFactory &&
    ((ConfigurableBeanFactory) owner).isCurrentlyInCreation(bd.getFactoryBeanName())) {
  msg = "Circular reference involving containing bean '" + bd.getFactoryBeanName() + "' - consider " +
      "declaring the factory method as static for independence from its containing instance. " + msg;
origin: org.springframework/spring-context

if (beanFactory.isCurrentlyInCreation(scopedBeanName)) {
  beanName = scopedBeanName;
origin: camunda/camunda-bpm-platform

public Object getObject() throws BeansException {
  BeanWrapper target = this.targetBeanWrapper;
  if (target != null) {
    if (logger.isWarnEnabled() && this.targetBeanName != null &&
        this.beanFactory instanceof ConfigurableBeanFactory &&
        ((ConfigurableBeanFactory) this.beanFactory).isCurrentlyInCreation(this.targetBeanName)) {
      logger.warn("Target bean '" + this.targetBeanName + "' is still in creation due to a circular " +
          "reference - obtained value for property '" + this.propertyPath + "' may be outdated!");
    }
  }
  else {
    // Fetch prototype target bean...
    Object bean = this.beanFactory.getBean(this.targetBeanName);
    target = PropertyAccessorFactory.forBeanPropertyAccess(bean);
  }
  return target.getPropertyValue(this.propertyPath);
}
origin: apache/servicemix-bundles

/**
 * Resolves the specified interceptor names to Advisor objects.
 * @see #setInterceptorNames
 */
private Advisor[] resolveInterceptorNames() {
  ConfigurableBeanFactory cbf = (this.beanFactory instanceof ConfigurableBeanFactory ?
      (ConfigurableBeanFactory) this.beanFactory : null);
  List<Advisor> advisors = new ArrayList<Advisor>();
  for (String beanName : this.interceptorNames) {
    if (cbf == null || !cbf.isCurrentlyInCreation(beanName)) {
      Object next = this.beanFactory.getBean(beanName);
      advisors.add(this.advisorAdapterRegistry.wrap(next));
    }
  }
  return advisors.toArray(new Advisor[advisors.size()]);
}
origin: apache/servicemix-bundles

/**
 * Check the BeanFactory to see whether the bean named <var>beanName</var> already
 * exists. Accounts for the fact that the requested bean may be "in creation", i.e.:
 * we're in the middle of servicing the initial request for this bean. From an enhanced
 * factory method's perspective, this means that the bean does not actually yet exist,
 * and that it is now our job to create it for the first time by executing the logic
 * in the corresponding factory method.
 * <p>Said another way, this check repurposes
 * {@link ConfigurableBeanFactory#isCurrentlyInCreation(String)} to determine whether
 * the container is calling this method or the user is calling this method.
 * @param beanName name of bean to check for
 * @return whether <var>beanName</var> already exists in the factory
 */
private boolean factoryContainsBean(ConfigurableBeanFactory beanFactory, String beanName) {
  return (beanFactory.containsBean(beanName) && !beanFactory.isCurrentlyInCreation(beanName));
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-aop

/**
 * Resolves the specified interceptor names to Advisor objects.
 * @see #setInterceptorNames
 */
private Advisor[] resolveInterceptorNames() {
  BeanFactory bf = this.beanFactory;
  ConfigurableBeanFactory cbf = (bf instanceof ConfigurableBeanFactory ? (ConfigurableBeanFactory) bf : null);
  List<Advisor> advisors = new ArrayList<>();
  for (String beanName : this.interceptorNames) {
    if (cbf == null || !cbf.isCurrentlyInCreation(beanName)) {
      Assert.state(bf != null, "BeanFactory required for resolving interceptor names");
      Object next = bf.getBean(beanName);
      advisors.add(this.advisorAdapterRegistry.wrap(next));
    }
  }
  return advisors.toArray(new Advisor[0]);
}
origin: apache/servicemix-bundles

@Override
public Object getObject() throws BeansException {
  BeanWrapper target = this.targetBeanWrapper;
  if (target != null) {
    if (logger.isWarnEnabled() && this.targetBeanName != null &&
        this.beanFactory instanceof ConfigurableBeanFactory &&
        ((ConfigurableBeanFactory) this.beanFactory).isCurrentlyInCreation(this.targetBeanName)) {
      logger.warn("Target bean '" + this.targetBeanName + "' is still in creation due to a circular " +
          "reference - obtained value for property '" + this.propertyPath + "' may be outdated!");
    }
  }
  else {
    // Fetch prototype target bean...
    Object bean = this.beanFactory.getBean(this.targetBeanName);
    target = PropertyAccessorFactory.forBeanPropertyAccess(bean);
  }
  return target.getPropertyValue(this.propertyPath);
}
origin: apache/servicemix-bundles

String msg = "Factory method '" + factoryMethod.getName() + "' threw exception";
if (bd.getFactoryBeanName() != null && owner instanceof ConfigurableBeanFactory &&
    ((ConfigurableBeanFactory) owner).isCurrentlyInCreation(bd.getFactoryBeanName())) {
  msg = "Circular reference involving containing bean '" + bd.getFactoryBeanName() + "' - consider " +
      "declaring the factory method as static for independence from its containing instance. " + msg;
origin: apache/servicemix-bundles

boolean alreadyInCreation = beanFactory.isCurrentlyInCreation(beanName);
try {
  if (alreadyInCreation) {
origin: apache/servicemix-bundles

if (beanFactory.isCurrentlyInCreation(scopedBeanName)) {
  beanName = scopedBeanName;
org.springframework.beans.factory.configConfigurableBeanFactoryisCurrentlyInCreation

Javadoc

Determine whether the specified bean is currently in creation.

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
  • getBeanClassLoader
    Return this factory's class loader for loading bean classes (only null if even the system ClassLoade
  • 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
  • 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

  • Making http requests using okhttp
  • setScale (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now