/** * Create a PrototypeAspectInstanceFactory. AspectJ will be called to * introspect to create AJType metadata using the type returned for the * given bean name from the BeanFactory. * @param beanFactory the BeanFactory to obtain instance(s) from * @param name the name of the bean */ public PrototypeAspectInstanceFactory(BeanFactory beanFactory, String name) { super(beanFactory, name); if (!beanFactory.isPrototype(name)) { throw new IllegalArgumentException( "Cannot use PrototypeAspectInstanceFactory with bean named '" + name + "': not a prototype"); } }
@Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { super.setBeanFactory(beanFactory); // Check whether the target bean is defined as prototype. if (!beanFactory.isPrototype(getTargetBeanName())) { throw new BeanDefinitionStoreException( "Cannot use prototype-based TargetSource against non-prototype bean with name '" + getTargetBeanName() + "': instances would not be independent"); } }
if (parentBeanFactory != null && !containsBeanDefinition(beanName)) { return parentBeanFactory.isPrototype(originalBeanName(name));
if (parentBeanFactory != null && !containsBeanDefinition(beanName)) { return parentBeanFactory.isPrototype(originalBeanName(name));
@Override protected void onInit() { if (StringUtils.hasText(this.targetBeanName)) { Assert.isTrue(this.getBeanFactory().isPrototype(this.targetBeanName), "target bean [" + this.targetBeanName + "] must have 'prototype' scope"); } }
public boolean isPrototype() { if (this.beanFactory == null) { throw new FactoryBeanNotInitializedException(); } return this.beanFactory.isPrototype(this.targetBeanName); }
private void createAndPublishEndpoint(String url, Object implementor) { ServerFactoryBean serverFactory = null; if (prototypeServerFactoryBeanName != null) { if (!beanFactory.isPrototype(prototypeServerFactoryBeanName)) { throw new IllegalArgumentException( if (!beanFactory.isPrototype(prototypeDataBindingBeanName)) { throw new IllegalArgumentException(
if (parentBeanFactory != null && !containsBeanDefinition(beanName)) { return parentBeanFactory.isPrototype(originalBeanName(name));
@Override public boolean isPrototype(String name) throws NoSuchBeanDefinitionException { for (BeanFactory f : factories) { try { boolean b = f.isPrototype(name); if (b) { return b; } } catch (BeansException e) { LOG.info("bean exception", e); } } return false; }
/** * Create a PrototypeAspectInstanceFactory. AspectJ will be called to * introspect to create AJType metadata using the type returned for the * given bean name from the BeanFactory. * @param beanFactory the BeanFactory to obtain instance(s) from * @param name the name of the bean */ public PrototypeAspectInstanceFactory(BeanFactory beanFactory, String name) { super(beanFactory, name); if (!beanFactory.isPrototype(name)) { throw new IllegalArgumentException( "Cannot use PrototypeAspectInstanceFactory with bean named '" + name + "': not a prototype"); } }
/** * Create a PrototypeAspectInstanceFactory. AspectJ will be called to * introspect to create AJType metadata using the type returned for the * given bean name from the BeanFactory. * @param beanFactory the BeanFactory to obtain instance(s) from * @param name the name of the bean */ public PrototypeAspectInstanceFactory(BeanFactory beanFactory, String name) { super(beanFactory, name); if (!beanFactory.isPrototype(name)) { throw new IllegalArgumentException( "Cannot use PrototypeAspectInstanceFactory with bean named '" + name + "': not a prototype"); } }
@Override protected void onInit() { if (StringUtils.hasText(this.targetBeanName)) { Assert.isTrue(this.getBeanFactory().isPrototype(this.targetBeanName), "target bean [" + this.targetBeanName + "] must have 'prototype' scope"); } }
public boolean isPrototype() { if (this.beanFactory == null) { throw new FactoryBeanNotInitializedException(); } return this.beanFactory.isPrototype(this.targetBeanName); }
@Override public boolean isPrototype() { if (this.beanFactory == null) { throw new FactoryBeanNotInitializedException(); } return this.beanFactory.isPrototype(this.targetBeanName); }
public Component generateAssistanceBeanNameField(Datasource<Dashboard> datasource, String fieldId) { Map<String, DashboardViewAssistant> assistantBeanMap = AppBeans.getAll(DashboardViewAssistant.class); BeanFactory bf = ((AbstractApplicationContext) AppContext.getApplicationContext()).getBeanFactory(); List<String> prototypeBeanNames = assistantBeanMap.keySet().stream() .filter(bn -> bf.isPrototype(bn)) .collect(toList()); LookupField lookupField = componentsFactory.createComponent(LookupField.class); lookupField.setOptionsList(prototypeBeanNames); return lookupField; }
private void initAssistant(WebDashboardFrame frame) { String assistantBeanName = StringUtils.isEmpty(getAssistantBeanName()) ? dashboard.getAssistantBeanName() : getAssistantBeanName(); if (StringUtils.isNotEmpty(assistantBeanName)) { DashboardViewAssistant assistantBean = AppBeans.get(assistantBeanName, DashboardViewAssistant.class); BeanFactory bf = ((AbstractApplicationContext) AppContext.getApplicationContext()).getBeanFactory(); if (assistantBean != null && bf.isPrototype(assistantBeanName)) { assistantBean.init(frame); dashboardViewAssistant = assistantBean; } } }
@Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { super.setBeanFactory(beanFactory); // Check whether the target bean is defined as prototype. if (!beanFactory.isPrototype(getTargetBeanName())) { throw new BeanDefinitionStoreException( "Cannot use prototype-based TargetSource against non-prototype bean with name '" + getTargetBeanName() + "': instances would not be independent"); } }
@Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { super.setBeanFactory(beanFactory); // Check whether the target bean is defined as prototype. if (!beanFactory.isPrototype(getTargetBeanName())) { throw new BeanDefinitionStoreException( "Cannot use prototype-based TargetSource against non-prototype bean with name '" + getTargetBeanName() + "': instances would not be independent"); } }
private void createAndPublishEndpoint(String url, Object implementor) { ServerFactoryBean serverFactory = null; if (prototypeServerFactoryBeanName != null) { if (!beanFactory.isPrototype(prototypeServerFactoryBeanName)) { throw new IllegalArgumentException( if (!beanFactory.isPrototype(prototypeDataBindingBeanName)) { throw new IllegalArgumentException(
if (parentBeanFactory != null && !containsBeanDefinition(beanName)) { return parentBeanFactory.isPrototype(originalBeanName(name)); if (mbd.isPrototype()) {