org.springframework.beans.factory.config.BeanDefinition.isPrototype()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(79)

本文整理了Java中org.springframework.beans.factory.config.BeanDefinition.isPrototype()方法的一些代码示例,展示了BeanDefinition.isPrototype()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BeanDefinition.isPrototype()方法的具体详情如下:
包路径:org.springframework.beans.factory.config.BeanDefinition
类名称:BeanDefinition
方法名:isPrototype

BeanDefinition.isPrototype介绍

[英]Return whether this a Prototype, with an independent instance returned for each call.
[中]返回这是否为原型,并为每个调用返回一个独立实例。

代码示例

代码示例来源:origin: Netflix/genie

.append(beanDefinition.isPrototype() ? ", prototype" : "")
.append(beanDefinition.isSingleton() ? ", singleton" : "")
.toString();

代码示例来源:origin: mulesoft/mule

private Component getReferencedProcessor(String name) {
 if (applicationContext instanceof MuleArtifactContext) {
  MuleArtifactContext muleArtifactContext = (MuleArtifactContext) applicationContext;
  try {
   if (muleArtifactContext.getBeanFactory().getBeanDefinition(name).isPrototype()) {
    muleArtifactContext.getPrototypeBeanWithRootContainer(name, getRootContainerLocation().toString());
   }
  } catch (NoSuchBeanDefinitionException e) {
   // Null is handled by the caller method
   return null;
  }
 }
 return (Component) applicationContext.getBean(name);
}

代码示例来源:origin: mulesoft/mule

/**
 * Returns a prototype chain of processors mutating the root container name of the set of beans created from that prototype
 * object.
 *
 * @param name the bean name
 * @param rootContainerName the new root container name.
 */
public synchronized void getPrototypeBeanWithRootContainer(String name, String rootContainerName) {
 BeanDefinition beanDefinition = getBeanFactory().getBeanDefinition(name);
 checkState(beanDefinition.isPrototype(), format("Bean with name %s is not a prototype", name));
 updateBeanDefinitionRootContainerName(rootContainerName, beanDefinition);
}

代码示例来源:origin: mulesoft/mule

if (beanFactory.containsBeanDefinition(beanName) && beanFactory.getBeanDefinition(beanName).isPrototype()) {

代码示例来源:origin: net.shibboleth.idp/idp-profile-impl

/** {@inheritDoc} */
  @Override
  public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) {
    for (final String beanName : beanFactory.getBeanNamesForAnnotation(Prototype.class)) {
      final BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName);
      if (!beanDefinition.isPrototype()) {
        log.warn("Profile action '{}' is not '{}' scope but must be, please check your configuration.",
            beanName, BeanDefinition.SCOPE_PROTOTYPE);
        beanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
      }
    }
  }
}

代码示例来源:origin: org.mule.runtime/mule-module-spring-config

/**
 * Returns a prototype chain of processors mutating the root container name of the set of beans created from that prototype
 * object.
 *
 * @param name the bean name
 * @param rootContainerName the new root container name.
 */
public synchronized void getPrototypeBeanWithRootContainer(String name, String rootContainerName) {
 BeanDefinition beanDefinition = getBeanFactory().getBeanDefinition(name);
 checkState(beanDefinition.isPrototype(), format("Bean with name %s is not a prototype", name));
 updateBeanDefinitionRootContainerName(rootContainerName, beanDefinition);
}

代码示例来源:origin: org.mule.runtime/mule-module-spring-config

private Component getReferencedProcessor(String name) {
 if (applicationContext instanceof MuleArtifactContext) {
  MuleArtifactContext muleArtifactContext = (MuleArtifactContext) applicationContext;
  try {
   if (muleArtifactContext.getBeanFactory().getBeanDefinition(name).isPrototype()) {
    muleArtifactContext.getPrototypeBeanWithRootContainer(name, getRootContainerLocation().toString());
   }
  } catch (NoSuchBeanDefinitionException e) {
   // Null is handled by the caller method
   return null;
  }
 }
 return (Component) applicationContext.getBean(name);
}

代码示例来源:origin: org.mule.runtime/mule-module-spring-config

if (beanFactory.containsBeanDefinition(beanName) && beanFactory.getBeanDefinition(beanName).isPrototype()) {

代码示例来源:origin: com.netflix.genie/genie-agent

.append(beanDefinition.isPrototype() ? ", prototype" : "")
.append(beanDefinition.isSingleton() ? ", singleton" : "")
.toString();

代码示例来源:origin: thymeleaf/thymeleaf-spring

null);
if (viewBeanDefinition == null || !viewBeanDefinition.isPrototype()) {

代码示例来源:origin: thymeleaf/thymeleaf-spring

null);
if (viewBeanDefinition == null || !viewBeanDefinition.isPrototype()) {

代码示例来源:origin: org.thymeleaf/thymeleaf-spring4

null);
if (viewBeanDefinition == null || !viewBeanDefinition.isPrototype()) {

代码示例来源:origin: thymeleaf/thymeleaf-spring

null);
if (viewBeanDefinition == null || !viewBeanDefinition.isPrototype()) {

代码示例来源:origin: thymeleaf/thymeleaf-spring

null);
if (viewBeanDefinition == null || !viewBeanDefinition.isPrototype()) {

代码示例来源:origin: org.thymeleaf/thymeleaf-spring3

null);
if (viewBeanDefinition == null || !viewBeanDefinition.isPrototype()) {

相关文章

微信公众号

最新文章

更多