/** * Add the supplied property value under the given name. */ public BeanDefinitionBuilder addPropertyValue(String name, @Nullable Object value) { this.beanDefinition.getPropertyValues().add(name, value); return this; }
/** * Add a reference to the specified bean name under the property specified. * @param name the name of the property to add the reference to * @param beanName the name of the bean being referenced */ public BeanDefinitionBuilder addPropertyReference(String name, String beanName) { this.beanDefinition.getPropertyValues().add(name, new RuntimeBeanReference(beanName)); return this; }
public void setPropertyValue(String property, Object newValue) { getBeanDefinition().getPropertyValues().addPropertyValue(property, newValue); }
/** * Add a reference to the specified bean name under the property specified. * @param name the name of the property to add the reference to * @param beanName the name of the bean being referenced */ public BeanDefinitionBuilder addPropertyReference(String name, String beanName) { this.beanDefinition.getPropertyValues().add(name, new RuntimeBeanReference(beanName)); return this; }
/** * Add the supplied property value under the given name. */ public BeanDefinitionBuilder addPropertyValue(String name, @Nullable Object value) { this.beanDefinition.getPropertyValues().add(name, value); return this; }
public void setProperty(String property, Object newValue) { if (!addDeferredProperty(property, newValue)) { this.beanDefinition.getBeanDefinition().getPropertyValues().add(property, newValue); } }
public BeanConfiguration addProperty(String propertyName, Object propertyValue) { if(propertyValue instanceof BeanConfiguration) { propertyValue = ((BeanConfiguration)propertyValue).getBeanDefinition(); } getBeanDefinition() .getPropertyValues() .addPropertyValue(propertyName,propertyValue); return this; }
public boolean hasProperty(String name) { return getBeanDefinition().getPropertyValues().contains(name); }
/** * Return an array of non-simple bean properties that are unsatisfied. * These are probably unsatisfied references to other beans in the * factory. Does not include simple properties like primitives or Strings. * @param mbd the merged bean definition the bean was created with * @param bw the BeanWrapper the bean was created with * @return an array of bean property names * @see org.springframework.beans.BeanUtils#isSimpleProperty */ protected String[] unsatisfiedNonSimpleProperties(AbstractBeanDefinition mbd, BeanWrapper bw) { Set<String> result = new TreeSet<>(); PropertyValues pvs = mbd.getPropertyValues(); PropertyDescriptor[] pds = bw.getPropertyDescriptors(); for (PropertyDescriptor pd : pds) { if (pd.getWriteMethod() != null && !isExcludedFromDependencyCheck(pd) && !pvs.contains(pd.getName()) && !BeanUtils.isSimpleProperty(pd.getPropertyType())) { result.add(pd.getName()); } } return StringUtils.toStringArray(result); }
public GroovyBeanDefinitionWrapper addProperty(String propertyName, Object propertyValue) { if (propertyValue instanceof GroovyBeanDefinitionWrapper) { propertyValue = ((GroovyBeanDefinitionWrapper) propertyValue).getBeanDefinition(); } getBeanDefinition().getPropertyValues().add(propertyName, propertyValue); return this; }
public Object getProperty(String property) { if (property.equals("beanName")) { return getBeanName(); } else if (property.equals("source")) { return getSource(); } else if (this.beanDefinition != null) { return new GroovyPropertyValue( property, this.beanDefinition.getBeanDefinition().getPropertyValues().get(property)); } else { return this.metaClass.getProperty(this, property); } }
public void setProperty(String property, Object newValue) { if (!addDeferredProperty(property, newValue)) { this.beanDefinition.getBeanDefinition().getPropertyValues().add(property, newValue); } }
public Object getPropertyValue(String name) { return getBeanDefinition() .getPropertyValues() .getPropertyValue(name) .getValue(); }
private void registerRunnerBeanDefinition() { DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) ((ConfigurableApplicationContext) applicationContext).getBeanFactory(); if (!beanFactory.containsBean(JOB_RUNNER_BEAN_NAME)) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(JobDispatcher.class); builder.setScope(BeanDefinition.SCOPE_SINGLETON); builder.setLazyInit(false); builder.getBeanDefinition().getPropertyValues().addPropertyValue("shardField", properties.getDispatchRunner().getShardValue()); beanFactory.registerBeanDefinition(JOB_RUNNER_BEAN_NAME, builder.getBeanDefinition()); } }
private void registerRunnerBeanDefinition() { DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) ((ConfigurableApplicationContext) applicationContext).getBeanFactory(); if (!beanFactory.containsBean(JOB_RUNNER_BEAN_NAME)) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(JobDispatcher.class); builder.setScope(BeanDefinition.SCOPE_SINGLETON); builder.setLazyInit(false); builder.getBeanDefinition().getPropertyValues().addPropertyValue("shardField", properties.getDispatchRunner().getShardValue()); beanFactory.registerBeanDefinition(JOB_RUNNER_BEAN_NAME, builder.getBeanDefinition()); } }
advisorDef.getPropertyValues().add(POINTCUT, pointcut); parserContext.registerComponent( new AdvisorComponentDefinition(advisorBeanName, advisorDef, (BeanDefinition) pointcut)); advisorDef.getPropertyValues().add(POINTCUT, new RuntimeBeanReference((String) pointcut)); parserContext.registerComponent( new AdvisorComponentDefinition(advisorBeanName, advisorDef));
public Object getProperty(String property) { if (property.equals("beanName")) { return getBeanName(); } else if (property.equals("source")) { return getSource(); } else if (this.beanDefinition != null) { return new GroovyPropertyValue( property, this.beanDefinition.getBeanDefinition().getPropertyValues().get(property)); } else { return this.metaClass.getProperty(this, property); } }
public GroovyBeanDefinitionWrapper addProperty(String propertyName, Object propertyValue) { if (propertyValue instanceof GroovyBeanDefinitionWrapper) { propertyValue = ((GroovyBeanDefinitionWrapper) propertyValue).getBeanDefinition(); } getBeanDefinition().getPropertyValues().add(propertyName, propertyValue); return this; }
MutablePropertyValues pvs = this.currentBeanDefinition.getBeanDefinition().getPropertyValues(); if (pvs.contains(name)) { return pvs.get(name);
private void setBaseProperties(AbstractBeanDefinition definition) { definition.setAbstract(true); definition.setAttribute("foo", "bar"); definition.setAutowireCandidate(false); definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE); // definition.getConstructorArgumentValues().addGenericArgumentValue("foo"); definition.setDependencyCheck(AbstractBeanDefinition.DEPENDENCY_CHECK_OBJECTS); definition.setDependsOn(new String[] { "foo", "bar" }); definition.setDestroyMethodName("destroy"); definition.setEnforceDestroyMethod(false); definition.setEnforceInitMethod(true); definition.setFactoryBeanName("factoryBean"); definition.setFactoryMethodName("factoryMethod"); definition.setInitMethodName("init"); definition.setLazyInit(true); definition.getMethodOverrides().addOverride(new LookupOverride("foo", "bar")); definition.getMethodOverrides().addOverride(new ReplaceOverride("foo", "bar")); definition.getPropertyValues().add("foo", "bar"); definition.setResourceDescription("desc"); definition.setRole(BeanDefinition.ROLE_APPLICATION); definition.setScope(BeanDefinition.SCOPE_PROTOTYPE); definition.setSource("foo"); }