added chaining-capable "add" method to MutablePropertyValues
This commit is contained in:
parent
a300aa19b6
commit
46cd083976
|
|
@ -83,11 +83,11 @@ public abstract class AbstractInterceptorDrivenBeanDefinitionDecorator implement
|
|||
proxyDefinition.setPropertyValues(mpvs);
|
||||
|
||||
// set the target
|
||||
mpvs.addPropertyValue("target", existingDefinition);
|
||||
mpvs.add("target", existingDefinition);
|
||||
|
||||
// create the interceptor names list
|
||||
ManagedList interceptorList = new ManagedList();
|
||||
mpvs.addPropertyValue("interceptorNames", interceptorList);
|
||||
mpvs.add("interceptorNames", interceptorList);
|
||||
|
||||
result = new BeanDefinitionHolder(proxyDefinition, existingBeanName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public abstract class AopConfigUtils {
|
|||
public static void forceAutoProxyCreatorToUseClassProxying(BeanDefinitionRegistry registry) {
|
||||
if (registry.containsBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME)) {
|
||||
BeanDefinition definition = registry.getBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME);
|
||||
definition.getPropertyValues().addPropertyValue("proxyTargetClass", Boolean.TRUE);
|
||||
definition.getPropertyValues().add("proxyTargetClass", Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ public abstract class AopConfigUtils {
|
|||
}
|
||||
RootBeanDefinition beanDefinition = new RootBeanDefinition(cls);
|
||||
beanDefinition.setSource(source);
|
||||
beanDefinition.getPropertyValues().addPropertyValue("order", Ordered.HIGHEST_PRECEDENCE);
|
||||
beanDefinition.getPropertyValues().add("order", Ordered.HIGHEST_PRECEDENCE);
|
||||
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
registry.registerBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME, beanDefinition);
|
||||
return beanDefinition;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class AspectJAutoProxyBeanDefinitionParser implements BeanDefinitionParser {
|
|||
}
|
||||
if (!includePatterns.isEmpty()) {
|
||||
includePatterns.setSource(parserContext.extractSource(element));
|
||||
beanDef.getPropertyValues().addPropertyValue("includePatterns", includePatterns);
|
||||
beanDef.getPropertyValues().add("includePatterns", includePatterns);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,12 +154,12 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
|
||||
Object pointcut = parsePointcutProperty(advisorElement, parserContext);
|
||||
if (pointcut instanceof BeanDefinition) {
|
||||
advisorDef.getPropertyValues().addPropertyValue(POINTCUT, pointcut);
|
||||
advisorDef.getPropertyValues().add(POINTCUT, pointcut);
|
||||
parserContext.registerComponent(
|
||||
new AdvisorComponentDefinition(advisorBeanName, advisorDef, (BeanDefinition) pointcut));
|
||||
}
|
||||
else if (pointcut instanceof String) {
|
||||
advisorDef.getPropertyValues().addPropertyValue(POINTCUT, new RuntimeBeanReference((String) pointcut));
|
||||
advisorDef.getPropertyValues().add(POINTCUT, new RuntimeBeanReference((String) pointcut));
|
||||
parserContext.registerComponent(
|
||||
new AdvisorComponentDefinition(advisorBeanName, advisorDef));
|
||||
}
|
||||
|
|
@ -183,12 +183,12 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
"'advice-ref' attribute contains empty value.", advisorElement, this.parseState.snapshot());
|
||||
}
|
||||
else {
|
||||
advisorDefinition.getPropertyValues().addPropertyValue(
|
||||
advisorDefinition.getPropertyValues().add(
|
||||
ADVICE_BEAN_NAME, new RuntimeBeanNameReference(adviceRef));
|
||||
}
|
||||
|
||||
if (advisorElement.hasAttribute(ORDER_PROPERTY)) {
|
||||
advisorDefinition.getPropertyValues().addPropertyValue(
|
||||
advisorDefinition.getPropertyValues().add(
|
||||
ORDER_PROPERTY, advisorElement.getAttribute(ORDER_PROPERTY));
|
||||
}
|
||||
|
||||
|
|
@ -321,14 +321,14 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
|
||||
// create the method factory bean
|
||||
RootBeanDefinition methodDefinition = new RootBeanDefinition(MethodLocatingFactoryBean.class);
|
||||
methodDefinition.getPropertyValues().addPropertyValue("targetBeanName", aspectName);
|
||||
methodDefinition.getPropertyValues().addPropertyValue("methodName", adviceElement.getAttribute("method"));
|
||||
methodDefinition.getPropertyValues().add("targetBeanName", aspectName);
|
||||
methodDefinition.getPropertyValues().add("methodName", adviceElement.getAttribute("method"));
|
||||
methodDefinition.setSynthetic(true);
|
||||
|
||||
// create instance factory definition
|
||||
RootBeanDefinition aspectFactoryDef =
|
||||
new RootBeanDefinition(SimpleBeanFactoryAwareAspectInstanceFactory.class);
|
||||
aspectFactoryDef.getPropertyValues().addPropertyValue("aspectBeanName", aspectName);
|
||||
aspectFactoryDef.getPropertyValues().add("aspectBeanName", aspectName);
|
||||
aspectFactoryDef.setSynthetic(true);
|
||||
|
||||
// register the pointcut
|
||||
|
|
@ -341,7 +341,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
advisorDefinition.setSource(parserContext.extractSource(adviceElement));
|
||||
advisorDefinition.getConstructorArgumentValues().addGenericArgumentValue(adviceDef);
|
||||
if (aspectElement.hasAttribute(ORDER_PROPERTY)) {
|
||||
advisorDefinition.getPropertyValues().addPropertyValue(
|
||||
advisorDefinition.getPropertyValues().add(
|
||||
ORDER_PROPERTY, aspectElement.getAttribute(ORDER_PROPERTY));
|
||||
}
|
||||
|
||||
|
|
@ -369,19 +369,19 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
RootBeanDefinition adviceDefinition = new RootBeanDefinition(getAdviceClass(adviceElement, parserContext));
|
||||
adviceDefinition.setSource(parserContext.extractSource(adviceElement));
|
||||
|
||||
adviceDefinition.getPropertyValues().addPropertyValue(ASPECT_NAME_PROPERTY, aspectName);
|
||||
adviceDefinition.getPropertyValues().addPropertyValue(DECLARATION_ORDER_PROPERTY, order);
|
||||
adviceDefinition.getPropertyValues().add(ASPECT_NAME_PROPERTY, aspectName);
|
||||
adviceDefinition.getPropertyValues().add(DECLARATION_ORDER_PROPERTY, order);
|
||||
|
||||
if (adviceElement.hasAttribute(RETURNING)) {
|
||||
adviceDefinition.getPropertyValues().addPropertyValue(
|
||||
adviceDefinition.getPropertyValues().add(
|
||||
RETURNING_PROPERTY, adviceElement.getAttribute(RETURNING));
|
||||
}
|
||||
if (adviceElement.hasAttribute(THROWING)) {
|
||||
adviceDefinition.getPropertyValues().addPropertyValue(
|
||||
adviceDefinition.getPropertyValues().add(
|
||||
THROWING_PROPERTY, adviceElement.getAttribute(THROWING));
|
||||
}
|
||||
if (adviceElement.hasAttribute(ARG_NAMES)) {
|
||||
adviceDefinition.getPropertyValues().addPropertyValue(
|
||||
adviceDefinition.getPropertyValues().add(
|
||||
ARG_NAMES_PROPERTY, adviceElement.getAttribute(ARG_NAMES));
|
||||
}
|
||||
|
||||
|
|
@ -507,7 +507,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
RootBeanDefinition beanDefinition = new RootBeanDefinition(AspectJExpressionPointcut.class);
|
||||
beanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
|
||||
beanDefinition.setSynthetic(true);
|
||||
beanDefinition.getPropertyValues().addPropertyValue(EXPRESSION, expression);
|
||||
beanDefinition.getPropertyValues().add(EXPRESSION, expression);
|
||||
return beanDefinition;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,14 +59,14 @@ public abstract class ScopedProxyUtils {
|
|||
scopedProxyDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
|
||||
String targetBeanName = getTargetBeanName(originalBeanName);
|
||||
scopedProxyDefinition.getPropertyValues().addPropertyValue("targetBeanName", targetBeanName);
|
||||
scopedProxyDefinition.getPropertyValues().add("targetBeanName", targetBeanName);
|
||||
|
||||
if (proxyTargetClass) {
|
||||
targetDefinition.setAttribute(AutoProxyUtils.PRESERVE_TARGET_CLASS_ATTRIBUTE, Boolean.TRUE);
|
||||
// ScopedFactoryBean's "proxyTargetClass" default is TRUE, so we don't need to set it explicitly here.
|
||||
}
|
||||
else {
|
||||
scopedProxyDefinition.getPropertyValues().addPropertyValue("proxyTargetClass", Boolean.FALSE);
|
||||
scopedProxyDefinition.getPropertyValues().add("proxyTargetClass", Boolean.FALSE);
|
||||
}
|
||||
|
||||
// Copy autowire settings from original bean definition.
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public final class PrototypeBasedTargetSourceTests {
|
|||
@Test
|
||||
public void testSerializability() throws Exception {
|
||||
MutablePropertyValues tsPvs = new MutablePropertyValues();
|
||||
tsPvs.addPropertyValue("targetBeanName", "person");
|
||||
tsPvs.add("targetBeanName", "person");
|
||||
RootBeanDefinition tsBd = new RootBeanDefinition(TestTargetSource.class, tsPvs);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -47,9 +47,8 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
|
||||
/**
|
||||
* Creates a new empty MutablePropertyValues object.
|
||||
* Property values can be added with the <code>addPropertyValue</code> methods.
|
||||
* @see #addPropertyValue(PropertyValue)
|
||||
* @see #addPropertyValue(String, Object)
|
||||
* <p>Property values can be added with the <code>add</code> method.
|
||||
* @see #add(String, Object)
|
||||
*/
|
||||
public MutablePropertyValues() {
|
||||
this.propertyValueList = new ArrayList<PropertyValue>();
|
||||
|
|
@ -119,13 +118,19 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
return this.propertyValueList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of PropertyValue entries in the list.
|
||||
*/
|
||||
public int size() {
|
||||
return this.propertyValueList.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy all given PropertyValues into this object. Guarantees PropertyValue
|
||||
* references are independent, although it can't deep copy objects currently
|
||||
* referenced by individual PropertyValue objects.
|
||||
* @param other the PropertyValues to copy
|
||||
* @return this object to allow creating objects, adding multiple PropertyValues
|
||||
* in a single statement
|
||||
* @return this in order to allow for adding multiple property values in a chain
|
||||
*/
|
||||
public MutablePropertyValues addPropertyValues(PropertyValues other) {
|
||||
if (other != null) {
|
||||
|
|
@ -141,8 +146,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
* Add all property values from the given Map.
|
||||
* @param other Map with property values keyed by property name,
|
||||
* which must be a String
|
||||
* @return this object to allow creating objects, adding multiple
|
||||
* PropertyValues in a single statement
|
||||
* @return this in order to allow for adding multiple property values in a chain
|
||||
*/
|
||||
public MutablePropertyValues addPropertyValues(Map<?, ?> other) {
|
||||
if (other != null) {
|
||||
|
|
@ -154,11 +158,10 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add a PropertyValue object, replacing any existing one
|
||||
* for the corresponding property.
|
||||
* Add a PropertyValue object, replacing any existing one for the
|
||||
* corresponding property or getting merged with it (if applicable).
|
||||
* @param pv PropertyValue object to add
|
||||
* @return this object to allow creating objects, adding multiple
|
||||
* PropertyValues in a single statement
|
||||
* @return this in order to allow for adding multiple property values in a chain
|
||||
*/
|
||||
public MutablePropertyValues addPropertyValue(PropertyValue pv) {
|
||||
for (int i = 0; i < this.propertyValueList.size(); i++) {
|
||||
|
|
@ -179,11 +182,25 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
* @param propertyName name of the property
|
||||
* @param propertyValue value of the property
|
||||
* @see #addPropertyValue(PropertyValue)
|
||||
* @deprecated as of Spring 3.0, in favor of the chaining-capable {@link #add}
|
||||
*/
|
||||
@Deprecated
|
||||
public void addPropertyValue(String propertyName, Object propertyValue) {
|
||||
addPropertyValue(new PropertyValue(propertyName, propertyValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a PropertyValue object, replacing any existing one for the
|
||||
* corresponding property or getting merged with it (if applicable).
|
||||
* @param propertyName name of the property
|
||||
* @param propertyValue value of the property
|
||||
* @return this in order to allow for adding multiple property values in a chain
|
||||
*/
|
||||
public MutablePropertyValues add(String propertyName, Object propertyValue) {
|
||||
addPropertyValue(new PropertyValue(propertyName, propertyValue));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify a PropertyValue object held in this object.
|
||||
* Indexed from 0.
|
||||
|
|
@ -209,15 +226,6 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
return newPv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded version of <code>removePropertyValue</code> that takes a property name.
|
||||
* @param propertyName name of the property
|
||||
* @see #removePropertyValue(PropertyValue)
|
||||
*/
|
||||
public void removePropertyValue(String propertyName) {
|
||||
removePropertyValue(getPropertyValue(propertyName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given PropertyValue, if contained.
|
||||
* @param pv the PropertyValue to remove
|
||||
|
|
@ -227,10 +235,12 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear this holder, removing all PropertyValues.
|
||||
* Overloaded version of <code>removePropertyValue</code> that takes a property name.
|
||||
* @param propertyName name of the property
|
||||
* @see #removePropertyValue(PropertyValue)
|
||||
*/
|
||||
public void clear() {
|
||||
this.propertyValueList.clear();
|
||||
public void removePropertyValue(String propertyName) {
|
||||
this.propertyValueList.remove(getPropertyValue(propertyName));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -247,34 +257,6 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the specified property as "processed" in the sense
|
||||
* of some processor calling the corresponding setter method
|
||||
* outside of the PropertyValue(s) mechanism.
|
||||
* <p>This will lead to <code>true</code> being returned from
|
||||
* a {@link #contains} call for the specified property.
|
||||
* @param propertyName the name of the property.
|
||||
*/
|
||||
public void registerProcessedProperty(String propertyName) {
|
||||
if (this.processedProperties == null) {
|
||||
this.processedProperties = new HashSet<String>();
|
||||
}
|
||||
this.processedProperties.add(propertyName);
|
||||
}
|
||||
|
||||
public boolean contains(String propertyName) {
|
||||
return (getPropertyValue(propertyName) != null ||
|
||||
(this.processedProperties != null && this.processedProperties.contains(propertyName)));
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.propertyValueList.isEmpty();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.propertyValueList.size();
|
||||
}
|
||||
|
||||
public PropertyValues changesSince(PropertyValues old) {
|
||||
MutablePropertyValues changes = new MutablePropertyValues();
|
||||
if (old == this) {
|
||||
|
|
@ -296,6 +278,30 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
return changes;
|
||||
}
|
||||
|
||||
public boolean contains(String propertyName) {
|
||||
return (getPropertyValue(propertyName) != null ||
|
||||
(this.processedProperties != null && this.processedProperties.contains(propertyName)));
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.propertyValueList.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register the specified property as "processed" in the sense
|
||||
* of some processor calling the corresponding setter method
|
||||
* outside of the PropertyValue(s) mechanism.
|
||||
* <p>This will lead to <code>true</code> being returned from
|
||||
* a {@link #contains} call for the specified property.
|
||||
* @param propertyName the name of the property.
|
||||
*/
|
||||
public void registerProcessedProperty(String propertyName) {
|
||||
if (this.processedProperties == null) {
|
||||
this.processedProperties = new HashSet<String>();
|
||||
}
|
||||
this.processedProperties.add(propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark this holder as containing converted values only
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -39,6 +39,16 @@ public interface PropertyValues {
|
|||
*/
|
||||
PropertyValue getPropertyValue(String propertyName);
|
||||
|
||||
/**
|
||||
* Return the changes since the previous PropertyValues.
|
||||
* Subclasses should also override <code>equals</code>.
|
||||
* @param old old property values
|
||||
* @return PropertyValues updated or new properties.
|
||||
* Return empty PropertyValues if there are no changes.
|
||||
* @see java.lang.Object#equals
|
||||
*/
|
||||
PropertyValues changesSince(PropertyValues old);
|
||||
|
||||
/**
|
||||
* Is there a property value (or other processing entry) for this property?
|
||||
* @param propertyName the name of the property we're interested in
|
||||
|
|
@ -51,14 +61,4 @@ public interface PropertyValues {
|
|||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Return the changes since the previous PropertyValues.
|
||||
* Subclasses should also override <code>equals</code>.
|
||||
* @param old old property values
|
||||
* @return PropertyValues updated or new properties.
|
||||
* Return empty PropertyValues if there are no changes.
|
||||
* @see java.lang.Object#equals
|
||||
*/
|
||||
PropertyValues changesSince(PropertyValues old);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public class BeanDefinitionVisitor {
|
|||
for (PropertyValue pv : pvArray) {
|
||||
Object newVal = resolveValue(pv.getValue());
|
||||
if (!ObjectUtils.nullSafeEquals(newVal, pv.getValue())) {
|
||||
pvs.addPropertyValue(pv.getName(), newVal);
|
||||
pvs.add(pv.getName(), newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,12 +99,14 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* <i>load-time weaving</i> is involved, to make sure that actual bean
|
||||
* classes are loaded as lazily as possible. The temporary loader is
|
||||
* then removed once the BeanFactory completes its bootstrap phase.
|
||||
* @since 2.5
|
||||
*/
|
||||
void setTempClassLoader(ClassLoader tempClassLoader);
|
||||
|
||||
/**
|
||||
* Return the temporary ClassLoader to use for type matching purposes,
|
||||
* if any.
|
||||
* @since 2.5
|
||||
*/
|
||||
ClassLoader getTempClassLoader();
|
||||
|
||||
|
|
@ -128,22 +130,26 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* <p>There is no expression support active in a BeanFactory by default.
|
||||
* An ApplicationContext will typically set a standard expression strategy
|
||||
* here, supporting "#{...}" expressions in a Unified EL compatible style.
|
||||
* @since 3.0
|
||||
*/
|
||||
void setBeanExpressionResolver(BeanExpressionResolver resolver);
|
||||
|
||||
/**
|
||||
* Return the resolution strategy for expressions in bean definition values.
|
||||
* @since 3.0
|
||||
*/
|
||||
BeanExpressionResolver getBeanExpressionResolver();
|
||||
|
||||
/**
|
||||
* Specify a Spring 3.0 ConversionService to use for converting
|
||||
* property values, as an alternative to JavaBeans PropertyEditors.
|
||||
* @since 3.0
|
||||
*/
|
||||
void setConversionService(ConversionService conversionService);
|
||||
|
||||
/**
|
||||
* Return the associated ConversionService, if any.
|
||||
* @since 3.0
|
||||
*/
|
||||
ConversionService getConversionService();
|
||||
|
||||
|
|
@ -183,6 +189,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* any custom editors or custom editor registrars irrelevant.
|
||||
* @see #addPropertyEditorRegistrar
|
||||
* @see #registerCustomEditor
|
||||
* @since 2.5
|
||||
*/
|
||||
void setTypeConverter(TypeConverter typeConverter);
|
||||
|
||||
|
|
@ -191,12 +198,14 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* instance for each call, since TypeConverters are usually <i>not</i> thread-safe.
|
||||
* <p>If the default PropertyEditor mechanism is active, the returned
|
||||
* TypeConverter will be aware of all custom editors that have been registered.
|
||||
* @since 2.5
|
||||
*/
|
||||
TypeConverter getTypeConverter();
|
||||
|
||||
/**
|
||||
* Add a String resolver for embedded values such as annotation attributes.
|
||||
* @param valueResolver the String resolver to apply to embedded values
|
||||
* @since 3.0
|
||||
*/
|
||||
void addEmbeddedValueResolver(StringValueResolver valueResolver);
|
||||
|
||||
|
|
@ -204,6 +213,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* Resolve the given embedded value, e.g. an annotation attribute.
|
||||
* @param value the value to resolve
|
||||
* @return the resolved value (may be the original value as-is)
|
||||
* @since 3.0
|
||||
*/
|
||||
String resolveEmbeddedValue(String value);
|
||||
|
||||
|
|
@ -253,6 +263,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
/**
|
||||
* Provides a security access control context relevant to this factory.
|
||||
* @return the applicable AccessControlContext (never <code>null</code>)
|
||||
* @since 3.0
|
||||
*/
|
||||
AccessControlContext getAccessControlContext();
|
||||
|
||||
|
|
@ -284,6 +295,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* <p>The value resolver may for example resolve placeholders
|
||||
* in target bean names and even in alias names.
|
||||
* @param valueResolver the StringValueResolver to apply
|
||||
* @since 2.5
|
||||
*/
|
||||
void resolveAliases(StringValueResolver valueResolver);
|
||||
|
||||
|
|
@ -294,6 +306,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* @param beanName the name of the bean to retrieve the merged definition for
|
||||
* @return a (potentially merged) BeanDefinition for the given bean
|
||||
* @throws NoSuchBeanDefinitionException if there is no bean definition with the given name
|
||||
* @since 2.5
|
||||
*/
|
||||
BeanDefinition getMergedBeanDefinition(String beanName) throws NoSuchBeanDefinitionException;
|
||||
|
||||
|
|
@ -303,6 +316,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* @return whether the bean is a FactoryBean
|
||||
* (<code>false</code> means the bean exists but is not a FactoryBean)
|
||||
* @throws NoSuchBeanDefinitionException if there is no bean with the given name
|
||||
* @since 2.5
|
||||
*/
|
||||
boolean isFactoryBean(String name) throws NoSuchBeanDefinitionException;
|
||||
|
||||
|
|
@ -310,6 +324,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* Determine whether the specified bean is currently in creation.
|
||||
* @param beanName the name of the bean
|
||||
* @return whether the bean is currently in creation
|
||||
* @since 2.5
|
||||
*/
|
||||
boolean isCurrentlyInCreation(String beanName);
|
||||
|
||||
|
|
@ -318,6 +333,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* to be destroyed before the given bean is destroyed.
|
||||
* @param beanName the name of the bean
|
||||
* @param dependentBeanName the name of the dependent bean
|
||||
* @since 2.5
|
||||
*/
|
||||
void registerDependentBean(String beanName, String dependentBeanName);
|
||||
|
||||
|
|
@ -325,6 +341,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* Return the names of all beans which depend on the specified bean, if any.
|
||||
* @param beanName the name of the bean
|
||||
* @return the array of dependent bean names, or an empty array if none
|
||||
* @since 2.5
|
||||
*/
|
||||
String[] getDependentBeans(String beanName);
|
||||
|
||||
|
|
@ -333,6 +350,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
|||
* @param beanName the name of the bean
|
||||
* @return the array of names of beans which the bean depends on,
|
||||
* or an empty array if none
|
||||
* @since 2.5
|
||||
*/
|
||||
String[] getDependenciesForBean(String beanName);
|
||||
|
||||
|
|
|
|||
|
|
@ -1083,7 +1083,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
|||
for (String propertyName : propertyNames) {
|
||||
if (containsBean(propertyName)) {
|
||||
Object bean = getBean(propertyName);
|
||||
pvs.addPropertyValue(propertyName, bean);
|
||||
pvs.add(propertyName, bean);
|
||||
registerDependentBean(propertyName, beanName);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(
|
||||
|
|
@ -1131,7 +1131,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
|||
|
||||
Object autowiredArgument = resolveDependency(desc, beanName, autowiredBeanNames, converter);
|
||||
if (autowiredArgument != null) {
|
||||
pvs.addPropertyValue(propertyName, autowiredArgument);
|
||||
pvs.add(propertyName, autowiredArgument);
|
||||
}
|
||||
for (String autowiredBeanName : autowiredBeanNames) {
|
||||
registerDependentBean(autowiredBeanName, beanName);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.beans.factory.support;
|
||||
|
||||
import org.springframework.beans.PropertyValue;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
|
|
@ -194,7 +193,8 @@ public class BeanDefinitionBuilder {
|
|||
* and all additions are at the present point.
|
||||
*/
|
||||
public BeanDefinitionBuilder addConstructorArgValue(Object value) {
|
||||
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(this.constructorArgIndex++, value);
|
||||
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(
|
||||
this.constructorArgIndex++, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
@ -203,14 +203,16 @@ public class BeanDefinitionBuilder {
|
|||
* @see #addConstructorArgValue(Object)
|
||||
*/
|
||||
public BeanDefinitionBuilder addConstructorArgReference(String beanName) {
|
||||
return addConstructorArgValue(new RuntimeBeanReference(beanName));
|
||||
this.beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(
|
||||
this.constructorArgIndex++, new RuntimeBeanReference(beanName));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the supplied property value under the given name.
|
||||
*/
|
||||
public BeanDefinitionBuilder addPropertyValue(String name, Object value) {
|
||||
this.beanDefinition.getPropertyValues().addPropertyValue(new PropertyValue(name, value));
|
||||
this.beanDefinition.getPropertyValues().add(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +222,8 @@ public class BeanDefinitionBuilder {
|
|||
* @param beanName the name of the bean being referenced
|
||||
*/
|
||||
public BeanDefinitionBuilder addPropertyReference(String name, String beanName) {
|
||||
return addPropertyValue(name, new RuntimeBeanReference(beanName));
|
||||
this.beanDefinition.getPropertyValues().add(name, new RuntimeBeanReference(beanName));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -459,11 +459,11 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
|
|||
// It doesn't matter if the referenced bean hasn't yet been registered:
|
||||
// this will ensure that the reference is resolved at runtime.
|
||||
Object val = new RuntimeBeanReference(ref);
|
||||
pvs.addPropertyValue(property, val);
|
||||
pvs.add(property, val);
|
||||
}
|
||||
else {
|
||||
// It's a normal bean property.
|
||||
pvs.addPropertyValue(property, readValue(entry));
|
||||
pvs.add(property, readValue(entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -44,7 +44,7 @@ public final class ParserContext {
|
|||
|
||||
private BeanDefinition containingBeanDefinition;
|
||||
|
||||
private final Stack containingComponents = new Stack();
|
||||
private final Stack<ComponentDefinition> containingComponents = new Stack<ComponentDefinition>();
|
||||
|
||||
|
||||
public ParserContext(XmlReaderContext readerContext, BeanDefinitionParserDelegate delegate) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -44,6 +44,7 @@ import org.springframework.core.Conventions;
|
|||
* be injected into that property.
|
||||
*
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
*/
|
||||
public class SimplePropertyNamespaceHandler implements NamespaceHandler {
|
||||
|
|
@ -72,11 +73,10 @@ public class SimplePropertyNamespaceHandler implements NamespaceHandler {
|
|||
}
|
||||
if (propertyName.endsWith(REF_SUFFIX)) {
|
||||
propertyName = propertyName.substring(0, propertyName.length() - REF_SUFFIX.length());
|
||||
pvs.addPropertyValue(
|
||||
Conventions.attributeNameToPropertyName(propertyName), new RuntimeBeanReference(propertyValue));
|
||||
pvs.add(Conventions.attributeNameToPropertyName(propertyName), new RuntimeBeanReference(propertyValue));
|
||||
}
|
||||
else {
|
||||
pvs.addPropertyValue(Conventions.attributeNameToPropertyName(propertyName), propertyValue);
|
||||
pvs.add(Conventions.attributeNameToPropertyName(propertyName), propertyValue);
|
||||
}
|
||||
}
|
||||
return definition;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import java.util.SortedMap;
|
|||
import java.util.SortedSet;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Test;
|
||||
|
|
@ -252,7 +251,7 @@ public final class BeanWrapperTests {
|
|||
@Test
|
||||
public void testIgnoringIndexedProperty() {
|
||||
MutablePropertyValues values = new MutablePropertyValues();
|
||||
values.addPropertyValue("toBeIgnored[0]", new Integer(42));
|
||||
values.add("toBeIgnored[0]", new Integer(42));
|
||||
BeanWrapper bw = new BeanWrapperImpl(new Object());
|
||||
bw.setPropertyValues(values, true);
|
||||
}
|
||||
|
|
@ -260,7 +259,7 @@ public final class BeanWrapperTests {
|
|||
@Test
|
||||
public void testConvertPrimitiveToString() {
|
||||
MutablePropertyValues values = new MutablePropertyValues();
|
||||
values.addPropertyValue("name", new Integer(42));
|
||||
values.add("name", new Integer(42));
|
||||
TestBean tb = new TestBean();
|
||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||
bw.setPropertyValues(values);
|
||||
|
|
@ -270,7 +269,7 @@ public final class BeanWrapperTests {
|
|||
@Test
|
||||
public void testConvertClassToString() {
|
||||
MutablePropertyValues values = new MutablePropertyValues();
|
||||
values.addPropertyValue("name", Integer.class);
|
||||
values.add("name", Integer.class);
|
||||
TestBean tb = new TestBean();
|
||||
BeanWrapper bw = new BeanWrapperImpl(tb);
|
||||
bw.registerCustomEditor(String.class, new PropertyEditorSupport() {
|
||||
|
|
@ -874,16 +873,16 @@ public final class BeanWrapperTests {
|
|||
assertEquals("nameY", bw.getPropertyValue("map[key4][1].name"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].name", "name2");
|
||||
pvs.addPropertyValue("set[0].name", "name8");
|
||||
pvs.addPropertyValue("set[1].name", "name9");
|
||||
pvs.addPropertyValue("map[key1].name", "name1");
|
||||
pvs.addPropertyValue("map['key.3'].name", "name0");
|
||||
pvs.addPropertyValue("map[key4][0].name", "nameA");
|
||||
pvs.addPropertyValue("map[key4][1].name", "nameB");
|
||||
pvs.add("array[0].name", "name5");
|
||||
pvs.add("array[1].name", "name4");
|
||||
pvs.add("list[0].name", "name3");
|
||||
pvs.add("list[1].name", "name2");
|
||||
pvs.add("set[0].name", "name8");
|
||||
pvs.add("set[1].name", "name9");
|
||||
pvs.add("map[key1].name", "name1");
|
||||
pvs.add("map['key.3'].name", "name0");
|
||||
pvs.add("map[key4][0].name", "nameA");
|
||||
pvs.add("map[key4][1].name", "nameB");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("name5", tb0.getName());
|
||||
assertEquals("name4", tb1.getName());
|
||||
|
|
@ -927,16 +926,16 @@ public final class BeanWrapperTests {
|
|||
assertEquals(tb5, bw.getPropertyValue("map[\"key2\"]"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0]", tb5);
|
||||
pvs.addPropertyValue("array[1]", tb4);
|
||||
pvs.addPropertyValue("list[0]", tb3);
|
||||
pvs.addPropertyValue("list[1]", tb2);
|
||||
pvs.addPropertyValue("list[2]", tb0);
|
||||
pvs.addPropertyValue("list[4]", tb1);
|
||||
pvs.addPropertyValue("map[key1]", tb1);
|
||||
pvs.addPropertyValue("map['key2']", tb0);
|
||||
pvs.addPropertyValue("map[key5]", tb4);
|
||||
pvs.addPropertyValue("map['key9']", tb5);
|
||||
pvs.add("array[0]", tb5);
|
||||
pvs.add("array[1]", tb4);
|
||||
pvs.add("list[0]", tb3);
|
||||
pvs.add("list[1]", tb2);
|
||||
pvs.add("list[2]", tb0);
|
||||
pvs.add("list[4]", tb1);
|
||||
pvs.add("map[key1]", tb1);
|
||||
pvs.add("map['key2']", tb0);
|
||||
pvs.add("map[key5]", tb4);
|
||||
pvs.add("map['key9']", tb5);
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals(tb5, bean.getArray()[0]);
|
||||
assertEquals(tb4, bean.getArray()[1]);
|
||||
|
|
@ -976,15 +975,15 @@ public final class BeanWrapperTests {
|
|||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("map[key1]", "rod");
|
||||
pvs.addPropertyValue("map[key2]", "rob");
|
||||
pvs.add("map[key1]", "rod");
|
||||
pvs.add("map[key2]", "rob");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("rod", ((TestBean) bean.getMap().get("key1")).getName());
|
||||
assertEquals("rob", ((TestBean) bean.getMap().get("key2")).getName());
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("map[key1]", "rod");
|
||||
pvs.addPropertyValue("map[key2]", "");
|
||||
pvs.add("map[key1]", "rod");
|
||||
pvs.add("map[key2]", "");
|
||||
try {
|
||||
bw.setPropertyValues(pvs);
|
||||
fail("Should have thrown TypeMismatchException");
|
||||
|
|
@ -1012,7 +1011,7 @@ public final class BeanWrapperTests {
|
|||
inputMap.put(new Integer(1), "rod");
|
||||
inputMap.put(new Integer(2), "rob");
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("map", Collections.unmodifiableMap(inputMap));
|
||||
pvs.add("map", Collections.unmodifiableMap(inputMap));
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("rod", ((TestBean) bean.getMap().get(new Integer(1))).getName());
|
||||
assertEquals("rob", ((TestBean) bean.getMap().get(new Integer(2))).getName());
|
||||
|
|
@ -1035,7 +1034,7 @@ public final class BeanWrapperTests {
|
|||
inputMap.put(new Integer(1), "rod");
|
||||
inputMap.put(new Integer(2), "rob");
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("map", new ReadOnlyMap(inputMap));
|
||||
pvs.add("map", new ReadOnlyMap(inputMap));
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("rod", ((TestBean) bean.getMap().get(new Integer(1))).getName());
|
||||
assertEquals("rob", ((TestBean) bean.getMap().get(new Integer(2))).getName());
|
||||
|
|
@ -1051,7 +1050,7 @@ public final class BeanWrapperTests {
|
|||
inputMap.put(new Integer(2), "rob");
|
||||
ReadOnlyMap readOnlyMap = new ReadOnlyMap(inputMap);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("map", readOnlyMap);
|
||||
pvs.add("map", readOnlyMap);
|
||||
bw.setPropertyValues(pvs);
|
||||
assertSame(readOnlyMap, bean.getMap());
|
||||
assertFalse(readOnlyMap.isAccessed());
|
||||
|
|
|
|||
|
|
@ -550,7 +550,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
public void testSelfReference() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("self"));
|
||||
pvs.add("spouse", new RuntimeBeanReference("self"));
|
||||
lbf.registerBeanDefinition("self", new RootBeanDefinition(TestBean.class, pvs));
|
||||
TestBean self = (TestBean) lbf.getBean("self");
|
||||
assertEquals(self, self.getSpouse());
|
||||
|
|
@ -561,7 +561,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
try {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("ag", "foobar");
|
||||
pvs.add("ag", "foobar");
|
||||
lbf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
|
||||
lbf.getBean("tb");
|
||||
fail("Should throw exception on invalid property");
|
||||
|
|
@ -685,8 +685,8 @@ public final class DefaultListableBeanFactoryTests {
|
|||
|
||||
RootBeanDefinition parentDefinition = new RootBeanDefinition(TestBean.class);
|
||||
parentDefinition.setAbstract(true);
|
||||
parentDefinition.getPropertyValues().addPropertyValue("name", EXPECTED_NAME);
|
||||
parentDefinition.getPropertyValues().addPropertyValue("age", new Integer(EXPECTED_AGE));
|
||||
parentDefinition.getPropertyValues().add("name", EXPECTED_NAME);
|
||||
parentDefinition.getPropertyValues().add("age", new Integer(EXPECTED_AGE));
|
||||
|
||||
ChildBeanDefinition childDefinition = new ChildBeanDefinition("alias");
|
||||
|
||||
|
|
@ -832,7 +832,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("myFloat", "1,1");
|
||||
pvs.add("myFloat", "1,1");
|
||||
lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs));
|
||||
TestBean testBean = (TestBean) lbf.getBean("testBean");
|
||||
assertTrue(testBean.getMyFloat().floatValue() == 1.1f);
|
||||
|
|
@ -855,7 +855,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
});
|
||||
lbf.setConversionService(conversionService);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("myFloat", "1,1");
|
||||
pvs.add("myFloat", "1,1");
|
||||
lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs));
|
||||
TestBean testBean = (TestBean) lbf.getBean("testBean");
|
||||
assertTrue(testBean.getMyFloat().floatValue() == 1.1f);
|
||||
|
|
@ -871,7 +871,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("myFloat", new RuntimeBeanReference("myFloat"));
|
||||
pvs.add("myFloat", new RuntimeBeanReference("myFloat"));
|
||||
lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs));
|
||||
lbf.registerSingleton("myFloat", "1,1");
|
||||
TestBean testBean = (TestBean) lbf.getBean("testBean");
|
||||
|
|
@ -884,7 +884,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
|
||||
lbf.setTypeConverter(new CustomTypeConverter(nf));
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("myFloat", "1,1");
|
||||
pvs.add("myFloat", "1,1");
|
||||
ConstructorArgumentValues cav = new ConstructorArgumentValues();
|
||||
cav.addIndexedArgumentValue(0, "myName");
|
||||
cav.addIndexedArgumentValue(1, "myAge");
|
||||
|
|
@ -901,7 +901,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
|
||||
lbf.setTypeConverter(new CustomTypeConverter(nf));
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("myFloat", new RuntimeBeanReference("myFloat"));
|
||||
pvs.add("myFloat", new RuntimeBeanReference("myFloat"));
|
||||
ConstructorArgumentValues cav = new ConstructorArgumentValues();
|
||||
cav.addIndexedArgumentValue(0, "myName");
|
||||
cav.addIndexedArgumentValue(1, "myAge");
|
||||
|
|
@ -973,8 +973,8 @@ public final class DefaultListableBeanFactoryTests {
|
|||
public void testRegisterExistingSingletonWithAutowire() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Tony");
|
||||
pvs.addPropertyValue("age", "48");
|
||||
pvs.add("name", "Tony");
|
||||
pvs.add("age", "48");
|
||||
RootBeanDefinition bd = new RootBeanDefinition(DependenciesBean.class, pvs);
|
||||
bd.setDependencyCheck(RootBeanDefinition.DEPENDENCY_CHECK_OBJECTS);
|
||||
bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
|
|
@ -1115,7 +1115,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
public void testAutowireWithSatisfiedJavaBeanDependency() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.add("name", "Rod");
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs);
|
||||
lbf.registerBeanDefinition("rod", bd);
|
||||
assertEquals(1, lbf.getBeanDefinitionCount());
|
||||
|
|
@ -1131,7 +1131,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
public void testAutowireWithSatisfiedConstructorDependency() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.add("name", "Rod");
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs);
|
||||
lbf.registerBeanDefinition("rod", bd);
|
||||
assertEquals(1, lbf.getBeanDefinitionCount());
|
||||
|
|
@ -1392,7 +1392,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
public void testApplyBeanPropertyValues() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "99");
|
||||
pvs.add("age", "99");
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, pvs));
|
||||
TestBean tb = new TestBean();
|
||||
assertEquals(0, tb.getAge());
|
||||
|
|
@ -1404,7 +1404,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
public void testApplyBeanPropertyValuesWithIncompleteDefinition() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "99");
|
||||
pvs.add("age", "99");
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(null, pvs));
|
||||
TestBean tb = new TestBean();
|
||||
assertEquals(0, tb.getAge());
|
||||
|
|
@ -1418,7 +1418,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
public void testConfigureBean() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "99");
|
||||
pvs.add("age", "99");
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, pvs));
|
||||
TestBean tb = new TestBean();
|
||||
assertEquals(0, tb.getAge());
|
||||
|
|
@ -1434,7 +1434,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, new MutablePropertyValues());
|
||||
lbf.registerBeanDefinition("spouse", bd);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "99");
|
||||
pvs.add("age", "99");
|
||||
lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_NAME));
|
||||
TestBean tb = new TestBean();
|
||||
lbf.configureBean(tb, "test");
|
||||
|
|
@ -1753,8 +1753,8 @@ public final class DefaultListableBeanFactoryTests {
|
|||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
rbd.getPropertyValues().addPropertyValue("name", "juergen");
|
||||
rbd.getPropertyValues().addPropertyValue("age", "99");
|
||||
rbd.getPropertyValues().add("name", "juergen");
|
||||
rbd.getPropertyValues().add("age", "99");
|
||||
lbf.registerBeanDefinition("test", rbd);
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start("prototype");
|
||||
|
|
@ -1802,7 +1802,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
rbd.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("spouse"));
|
||||
rbd.getPropertyValues().add("spouse", new RuntimeBeanReference("spouse"));
|
||||
lbf.registerBeanDefinition("test", rbd);
|
||||
lbf.registerBeanDefinition("spouse", new RootBeanDefinition(TestBean.class));
|
||||
TestBean spouse = (TestBean) lbf.getBean("spouse");
|
||||
|
|
@ -1882,7 +1882,7 @@ public final class DefaultListableBeanFactoryTests {
|
|||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition instanceFactoryDefinition = new RootBeanDefinition(BeanWithFactoryMethod.class);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", expectedNameFromProperties);
|
||||
pvs.add("name", expectedNameFromProperties);
|
||||
instanceFactoryDefinition.setPropertyValues(pvs);
|
||||
lbf.registerBeanDefinition("factoryBeanInstance", instanceFactoryDefinition);
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
|
|||
bf.addBeanPostProcessor(bpp);
|
||||
RootBeanDefinition annotatedBd = new RootBeanDefinition(TypedExtendedResourceInjectionBean.class);
|
||||
TestBean tb2 = new TestBean();
|
||||
annotatedBd.getPropertyValues().addPropertyValue("testBean2", tb2);
|
||||
annotatedBd.getPropertyValues().add("testBean2", tb2);
|
||||
bf.registerBeanDefinition("annotatedBean", annotatedBd);
|
||||
TestBean tb = new TestBean();
|
||||
bf.registerSingleton("testBean", tb);
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ public class InjectAnnotationBeanPostProcessorTests {
|
|||
bf.addBeanPostProcessor(bpp);
|
||||
RootBeanDefinition annotatedBd = new RootBeanDefinition(TypedExtendedResourceInjectionBean.class);
|
||||
TestBean tb2 = new TestBean();
|
||||
annotatedBd.getPropertyValues().addPropertyValue("testBean2", tb2);
|
||||
annotatedBd.getPropertyValues().add("testBean2", tb2);
|
||||
bf.registerBeanDefinition("annotatedBean", annotatedBd);
|
||||
TestBean tb = new TestBean();
|
||||
bf.registerSingleton("testBean", tb);
|
||||
|
|
|
|||
|
|
@ -60,10 +60,10 @@ public final class CustomEditorConfigurerTests {
|
|||
cec.postProcessBeanFactory(bf);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("date", "2.12.1975");
|
||||
pvs.add("date", "2.12.1975");
|
||||
bf.registerBeanDefinition("tb1", new RootBeanDefinition(TestBean.class, pvs));
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class));
|
||||
pvs.add("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class));
|
||||
bf.registerBeanDefinition("tb2", new RootBeanDefinition(TestBean.class, pvs));
|
||||
|
||||
TestBean tb1 = (TestBean) bf.getBean("tb1");
|
||||
|
|
@ -83,10 +83,10 @@ public final class CustomEditorConfigurerTests {
|
|||
cec.postProcessBeanFactory(bf);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("date", "2.12.1975");
|
||||
pvs.add("date", "2.12.1975");
|
||||
bf.registerBeanDefinition("tb1", new RootBeanDefinition(TestBean.class, pvs));
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class));
|
||||
pvs.add("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class));
|
||||
bf.registerBeanDefinition("tb2", new RootBeanDefinition(TestBean.class, pvs));
|
||||
|
||||
TestBean tb1 = (TestBean) bf.getBean("tb1");
|
||||
|
|
@ -105,7 +105,7 @@ public final class CustomEditorConfigurerTests {
|
|||
cec.postProcessBeanFactory(bf);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("date", "2.12.1975");
|
||||
pvs.add("date", "2.12.1975");
|
||||
bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
|
||||
|
||||
TestBean tb = (TestBean) bf.getBean("tb");
|
||||
|
|
@ -123,7 +123,7 @@ public final class CustomEditorConfigurerTests {
|
|||
cec.postProcessBeanFactory(bf);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("date", "2.12.1975");
|
||||
pvs.add("date", "2.12.1975");
|
||||
bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
|
||||
|
||||
TestBean tb = (TestBean) bf.getBean("tb");
|
||||
|
|
@ -141,7 +141,7 @@ public final class CustomEditorConfigurerTests {
|
|||
cec.postProcessBeanFactory(bf);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("stringArray", "xxx");
|
||||
pvs.add("stringArray", "xxx");
|
||||
bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
|
||||
|
||||
TestBean tb = (TestBean) bf.getBean("tb");
|
||||
|
|
|
|||
|
|
@ -351,11 +351,11 @@ public final class PropertyResourceConfigurerTests {
|
|||
Map singletonMap = Collections.singletonMap("myKey", "myValue");
|
||||
if (parentChildSeparation) {
|
||||
MutablePropertyValues pvs1 = new MutablePropertyValues();
|
||||
pvs1.addPropertyValue("age", "${age}");
|
||||
pvs1.add("age", "${age}");
|
||||
MutablePropertyValues pvs2 = new MutablePropertyValues();
|
||||
pvs2.addPropertyValue("name", "name${var}${var}${");
|
||||
pvs2.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs2.addPropertyValue("someMap", singletonMap);
|
||||
pvs2.add("name", "name${var}${var}${");
|
||||
pvs2.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs2.add("someMap", singletonMap);
|
||||
RootBeanDefinition parent = new RootBeanDefinition(TestBean.class, pvs1);
|
||||
ChildBeanDefinition bd = new ChildBeanDefinition("${parent}", pvs2);
|
||||
factory.registerBeanDefinition("parent1", parent);
|
||||
|
|
@ -363,10 +363,10 @@ public final class PropertyResourceConfigurerTests {
|
|||
}
|
||||
else {
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "${age}");
|
||||
pvs.addPropertyValue("name", "name${var}${var}${");
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.addPropertyValue("someMap", singletonMap);
|
||||
pvs.add("age", "${age}");
|
||||
pvs.add("name", "name${var}${var}${");
|
||||
pvs.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.add("someMap", singletonMap);
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs);
|
||||
factory.registerBeanDefinition("tb1", bd);
|
||||
}
|
||||
|
|
@ -379,13 +379,13 @@ public final class PropertyResourceConfigurerTests {
|
|||
List<Object> friends = new ManagedList<Object>();
|
||||
friends.add("na${age}me");
|
||||
friends.add(new RuntimeBeanReference("${ref}"));
|
||||
pvs.addPropertyValue("friends", friends);
|
||||
pvs.add("friends", friends);
|
||||
|
||||
Set<Object> someSet = new ManagedSet<Object>();
|
||||
someSet.add("na${age}me");
|
||||
someSet.add(new RuntimeBeanReference("${ref}"));
|
||||
someSet.add(new TypedStringValue("${age}", Integer.class));
|
||||
pvs.addPropertyValue("someSet", someSet);
|
||||
pvs.add("someSet", someSet);
|
||||
|
||||
Map<Object, Object> someMap = new ManagedMap<Object, Object>();
|
||||
someMap.put(new TypedStringValue("key${age}"), new TypedStringValue("${age}"));
|
||||
|
|
@ -393,11 +393,11 @@ public final class PropertyResourceConfigurerTests {
|
|||
someMap.put("key1", new RuntimeBeanReference("${ref}"));
|
||||
someMap.put("key2", "${age}name");
|
||||
MutablePropertyValues innerPvs = new MutablePropertyValues();
|
||||
innerPvs.addPropertyValue("touchy", "${os.name}");
|
||||
innerPvs.add("touchy", "${os.name}");
|
||||
someMap.put("key3", new RootBeanDefinition(TestBean.class, innerPvs));
|
||||
MutablePropertyValues innerPvs2 = new MutablePropertyValues(innerPvs);
|
||||
someMap.put("${key4}", new BeanDefinitionHolder(new ChildBeanDefinition("tb1", innerPvs2), "child"));
|
||||
pvs.addPropertyValue("someMap", someMap);
|
||||
pvs.add("someMap", someMap);
|
||||
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, cas, pvs);
|
||||
factory.registerBeanDefinition("tb2", bd);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class ServiceLoaderTests {
|
|||
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition bd = new RootBeanDefinition(ServiceLoaderFactoryBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bf.registerBeanDefinition("service", bd);
|
||||
ServiceLoader<?> serviceLoader = (ServiceLoader<?>) bf.getBean("service");
|
||||
assertTrue(serviceLoader.iterator().next() instanceof DocumentBuilderFactory);
|
||||
|
|
@ -58,7 +58,7 @@ public class ServiceLoaderTests {
|
|||
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition bd = new RootBeanDefinition(ServiceFactoryBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bf.registerBeanDefinition("service", bd);
|
||||
assertTrue(bf.getBean("service") instanceof DocumentBuilderFactory);
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ public class ServiceLoaderTests {
|
|||
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition bd = new RootBeanDefinition(ServiceListFactoryBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());
|
||||
bf.registerBeanDefinition("service", bd);
|
||||
List<?> serviceList = (List<?>) bf.getBean("service");
|
||||
assertTrue(serviceList.get(0) instanceof DocumentBuilderFactory);
|
||||
|
|
|
|||
|
|
@ -45,16 +45,16 @@ public class BeanDefinitionTests extends TestCase {
|
|||
|
||||
public void testBeanDefinitionEqualityWithPropertyValues() {
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("name", "myName");
|
||||
bd.getPropertyValues().addPropertyValue("age", "99");
|
||||
bd.getPropertyValues().add("name", "myName");
|
||||
bd.getPropertyValues().add("age", "99");
|
||||
RootBeanDefinition otherBd = new RootBeanDefinition(TestBean.class);
|
||||
otherBd.getPropertyValues().addPropertyValue("name", "myName");
|
||||
otherBd.getPropertyValues().add("name", "myName");
|
||||
assertTrue(!bd.equals(otherBd));
|
||||
assertTrue(!otherBd.equals(bd));
|
||||
otherBd.getPropertyValues().addPropertyValue("age", "11");
|
||||
otherBd.getPropertyValues().add("age", "11");
|
||||
assertTrue(!bd.equals(otherBd));
|
||||
assertTrue(!otherBd.equals(bd));
|
||||
otherBd.getPropertyValues().addPropertyValue("age", "99");
|
||||
otherBd.getPropertyValues().add("age", "99");
|
||||
assertTrue(bd.equals(otherBd));
|
||||
assertTrue(otherBd.equals(bd));
|
||||
assertTrue(bd.hashCode() == otherBd.hashCode());
|
||||
|
|
@ -117,8 +117,8 @@ public class BeanDefinitionTests extends TestCase {
|
|||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
|
||||
bd.getConstructorArgumentValues().addGenericArgumentValue("test");
|
||||
bd.getConstructorArgumentValues().addIndexedArgumentValue(1, new Integer(5));
|
||||
bd.getPropertyValues().addPropertyValue("name", "myName");
|
||||
bd.getPropertyValues().addPropertyValue("age", "99");
|
||||
bd.getPropertyValues().add("name", "myName");
|
||||
bd.getPropertyValues().add("age", "99");
|
||||
|
||||
ChildBeanDefinition childBd = new ChildBeanDefinition("bd");
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class BeanFactoryGenericsTests {
|
|||
Set<String> input = new HashSet<String>();
|
||||
input.add("4");
|
||||
input.add("5");
|
||||
rbd.getPropertyValues().addPropertyValue("integerSet", input);
|
||||
rbd.getPropertyValues().add("integerSet", input);
|
||||
|
||||
bf.registerBeanDefinition("genericBean", rbd);
|
||||
GenericBean<?> gb = (GenericBean<?>) bf.getBean("genericBean");
|
||||
|
|
@ -75,7 +75,7 @@ public class BeanFactoryGenericsTests {
|
|||
List<String> input = new ArrayList<String>();
|
||||
input.add("http://localhost:8080");
|
||||
input.add("http://localhost:9090");
|
||||
rbd.getPropertyValues().addPropertyValue("resourceList", input);
|
||||
rbd.getPropertyValues().add("resourceList", input);
|
||||
|
||||
bf.registerBeanDefinition("genericBean", rbd);
|
||||
GenericBean<?> gb = (GenericBean<?>) bf.getBean("genericBean");
|
||||
|
|
@ -105,7 +105,7 @@ public class BeanFactoryGenericsTests {
|
|||
|
||||
List input = new ArrayList();
|
||||
input.add(1);
|
||||
rbd.getPropertyValues().addPropertyValue("testBeanList", input);
|
||||
rbd.getPropertyValues().add("testBeanList", input);
|
||||
|
||||
bf.registerBeanDefinition("genericBean", rbd);
|
||||
try {
|
||||
|
|
@ -137,7 +137,7 @@ public class BeanFactoryGenericsTests {
|
|||
Map<String, String> input = new HashMap<String, String>();
|
||||
input.put("4", "5");
|
||||
input.put("6", "7");
|
||||
rbd.getPropertyValues().addPropertyValue("shortMap", input);
|
||||
rbd.getPropertyValues().add("shortMap", input);
|
||||
|
||||
bf.registerBeanDefinition("genericBean", rbd);
|
||||
GenericBean<?> gb = (GenericBean<?>) bf.getBean("genericBean");
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class DefinitionMetadataEqualsHashCodeTests extends TestCase {
|
|||
definition.setLazyInit(true);
|
||||
definition.getMethodOverrides().addOverride(new LookupOverride("foo", "bar"));
|
||||
definition.getMethodOverrides().addOverride(new ReplaceOverride("foo", "bar"));
|
||||
definition.getPropertyValues().addPropertyValue("foo", "bar");
|
||||
definition.getPropertyValues().add("foo", "bar");
|
||||
definition.setResourceDescription("desc");
|
||||
definition.setRole(BeanDefinition.ROLE_APPLICATION);
|
||||
definition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class AutowireWithExclusionTests extends TestCase {
|
|||
parent.preInstantiateSingletons();
|
||||
DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
|
||||
RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
robDef.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("sally"));
|
||||
robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
|
||||
child.registerBeanDefinition("rob2", robDef);
|
||||
TestBean rob = (TestBean) child.getBean("rob2");
|
||||
assertEquals("props1", rob.getSomeProperties().getProperty("name"));
|
||||
|
|
@ -71,10 +71,10 @@ public class AutowireWithExclusionTests extends TestCase {
|
|||
parent.preInstantiateSingletons();
|
||||
DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
|
||||
RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
robDef.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("sally"));
|
||||
robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
|
||||
child.registerBeanDefinition("rob2", robDef);
|
||||
RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class);
|
||||
propsDef.getPropertyValues().addPropertyValue("properties", "name=props3");
|
||||
propsDef.getPropertyValues().add("properties", "name=props3");
|
||||
child.registerBeanDefinition("props3", propsDef);
|
||||
TestBean rob = (TestBean) child.getBean("rob2");
|
||||
assertEquals("props1", rob.getSomeProperties().getProperty("name"));
|
||||
|
|
@ -87,10 +87,10 @@ public class AutowireWithExclusionTests extends TestCase {
|
|||
parent.preInstantiateSingletons();
|
||||
DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
|
||||
RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
robDef.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("sally"));
|
||||
robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
|
||||
child.registerBeanDefinition("rob2", robDef);
|
||||
RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class);
|
||||
propsDef.getPropertyValues().addPropertyValue("properties", "name=props3");
|
||||
propsDef.getPropertyValues().add("properties", "name=props3");
|
||||
propsDef.setPrimary(true);
|
||||
child.registerBeanDefinition("props3", propsDef);
|
||||
TestBean rob = (TestBean) child.getBean("rob2");
|
||||
|
|
@ -105,10 +105,10 @@ public class AutowireWithExclusionTests extends TestCase {
|
|||
parent.preInstantiateSingletons();
|
||||
DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
|
||||
RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
robDef.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("sally"));
|
||||
robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
|
||||
child.registerBeanDefinition("rob2", robDef);
|
||||
RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class);
|
||||
propsDef.getPropertyValues().addPropertyValue("properties", "name=props3");
|
||||
propsDef.getPropertyValues().add("properties", "name=props3");
|
||||
propsDef.setPrimary(true);
|
||||
child.registerBeanDefinition("props3", propsDef);
|
||||
TestBean rob = (TestBean) child.getBean("rob2");
|
||||
|
|
|
|||
|
|
@ -884,12 +884,12 @@ public class CustomEditorTests {
|
|||
assertEquals("name5", bw.getPropertyValue("map[\"key2\"].name"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].name", "name2");
|
||||
pvs.addPropertyValue("map[key1].name", "name1");
|
||||
pvs.addPropertyValue("map['key2'].name", "name0");
|
||||
pvs.add("array[0].name", "name5");
|
||||
pvs.add("array[1].name", "name4");
|
||||
pvs.add("list[0].name", "name3");
|
||||
pvs.add("list[1].name", "name2");
|
||||
pvs.add("map[key1].name", "name1");
|
||||
pvs.add("map['key2'].name", "name0");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("prefixname5", tb0.getName());
|
||||
assertEquals("prefixname4", tb1.getName());
|
||||
|
|
@ -948,12 +948,12 @@ public class CustomEditorTests {
|
|||
assertEquals("name5", bw.getPropertyValue("map[\"key2\"].name"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].name", "name2");
|
||||
pvs.addPropertyValue("map[key1].name", "name1");
|
||||
pvs.addPropertyValue("map['key2'].name", "name0");
|
||||
pvs.add("array[0].name", "name5");
|
||||
pvs.add("array[1].name", "name4");
|
||||
pvs.add("list[0].name", "name3");
|
||||
pvs.add("list[1].name", "name2");
|
||||
pvs.add("map[key1].name", "name1");
|
||||
pvs.add("map['key2'].name", "name0");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("arrayname5", tb0.getName());
|
||||
assertEquals("arrayname4", tb1.getName());
|
||||
|
|
@ -1027,12 +1027,12 @@ public class CustomEditorTests {
|
|||
assertEquals("name5", bw.getPropertyValue("map[\"key2\"].name"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].name", "name2");
|
||||
pvs.addPropertyValue("map[key1].name", "name1");
|
||||
pvs.addPropertyValue("map['key2'].name", "name0");
|
||||
pvs.add("array[0].name", "name5");
|
||||
pvs.add("array[1].name", "name4");
|
||||
pvs.add("list[0].name", "name3");
|
||||
pvs.add("list[1].name", "name2");
|
||||
pvs.add("map[key1].name", "name1");
|
||||
pvs.add("map['key2'].name", "name0");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("array0name5", tb0.getName());
|
||||
assertEquals("array1name4", tb1.getName());
|
||||
|
|
@ -1105,12 +1105,12 @@ public class CustomEditorTests {
|
|||
assertEquals("name5", bw.getPropertyValue("map['key2'].nestedIndexedBean.map[\"key2\"].name"));
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].nestedIndexedBean.array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].nestedIndexedBean.array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].nestedIndexedBean.list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].nestedIndexedBean.list[1].name", "name2");
|
||||
pvs.addPropertyValue("map[key1].nestedIndexedBean.map[\"key1\"].name", "name1");
|
||||
pvs.addPropertyValue("map['key2'].nestedIndexedBean.map[key2].name", "name0");
|
||||
pvs.add("array[0].nestedIndexedBean.array[0].name", "name5");
|
||||
pvs.add("array[1].nestedIndexedBean.array[1].name", "name4");
|
||||
pvs.add("list[0].nestedIndexedBean.list[0].name", "name3");
|
||||
pvs.add("list[1].nestedIndexedBean.list[1].name", "name2");
|
||||
pvs.add("map[key1].nestedIndexedBean.map[\"key1\"].name", "name1");
|
||||
pvs.add("map['key2'].nestedIndexedBean.map[key2].name", "name0");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("arrayname5", tb0.getNestedIndexedBean().getArray()[0].getName());
|
||||
assertEquals("arrayname4", tb1.getNestedIndexedBean().getArray()[1].getName());
|
||||
|
|
@ -1159,12 +1159,12 @@ public class CustomEditorTests {
|
|||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].nestedIndexedBean.array[0].name", "name5");
|
||||
pvs.addPropertyValue("array[1].nestedIndexedBean.array[1].name", "name4");
|
||||
pvs.addPropertyValue("list[0].nestedIndexedBean.list[0].name", "name3");
|
||||
pvs.addPropertyValue("list[1].nestedIndexedBean.list[1].name", "name2");
|
||||
pvs.addPropertyValue("map[key1].nestedIndexedBean.map[\"key1\"].name", "name1");
|
||||
pvs.addPropertyValue("map['key2'].nestedIndexedBean.map[key2].name", "name0");
|
||||
pvs.add("array[0].nestedIndexedBean.array[0].name", "name5");
|
||||
pvs.add("array[1].nestedIndexedBean.array[1].name", "name4");
|
||||
pvs.add("list[0].nestedIndexedBean.list[0].name", "name3");
|
||||
pvs.add("list[1].nestedIndexedBean.list[1].name", "name2");
|
||||
pvs.add("map[key1].nestedIndexedBean.map[\"key1\"].name", "name1");
|
||||
pvs.add("map['key2'].nestedIndexedBean.map[key2].name", "name0");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("arrayname5", tb0.getNestedIndexedBean().getArray()[0].getName());
|
||||
assertEquals("name4", tb1.getNestedIndexedBean().getArray()[1].getName());
|
||||
|
|
@ -1207,12 +1207,12 @@ public class CustomEditorTests {
|
|||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0]", "a");
|
||||
pvs.addPropertyValue("array[1]", "b");
|
||||
pvs.addPropertyValue("list[0]", "c");
|
||||
pvs.addPropertyValue("list[1]", "d");
|
||||
pvs.addPropertyValue("map[key1]", "e");
|
||||
pvs.addPropertyValue("map['key2']", "f");
|
||||
pvs.add("array[0]", "a");
|
||||
pvs.add("array[1]", "b");
|
||||
pvs.add("list[0]", "c");
|
||||
pvs.add("list[1]", "d");
|
||||
pvs.add("map[key1]", "e");
|
||||
pvs.add("map['key2']", "f");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("arraya", bean.getArray()[0].getName());
|
||||
assertEquals("arrayb", bean.getArray()[1].getName());
|
||||
|
|
@ -1282,12 +1282,12 @@ public class CustomEditorTests {
|
|||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0]", "a");
|
||||
pvs.addPropertyValue("array[1]", "b");
|
||||
pvs.addPropertyValue("list[0]", "c");
|
||||
pvs.addPropertyValue("list[1]", "d");
|
||||
pvs.addPropertyValue("map[key1]", "e");
|
||||
pvs.addPropertyValue("map['key2']", "f");
|
||||
pvs.add("array[0]", "a");
|
||||
pvs.add("array[1]", "b");
|
||||
pvs.add("list[0]", "c");
|
||||
pvs.add("list[1]", "d");
|
||||
pvs.add("map[key1]", "e");
|
||||
pvs.add("map['key2']", "f");
|
||||
bw.setPropertyValues(pvs);
|
||||
assertEquals("array0a", bean.getArray()[0].getName());
|
||||
assertEquals("array1b", bean.getArray()[1].getName());
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class MBeanServerBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
|||
String agentId = element.getAttribute(AGENT_ID_ATTRIBUTE);
|
||||
if (StringUtils.hasText(agentId)) {
|
||||
RootBeanDefinition bd = new RootBeanDefinition(MBeanServerFactoryBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("agentId", agentId);
|
||||
bd.getPropertyValues().add("agentId", agentId);
|
||||
return bd;
|
||||
}
|
||||
AbstractBeanDefinition specialServer = findServerForSpecialEnvironment();
|
||||
|
|
@ -74,7 +74,7 @@ class MBeanServerBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
|||
return specialServer;
|
||||
}
|
||||
RootBeanDefinition bd = new RootBeanDefinition(MBeanServerFactoryBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("locateExistingServerIfPossible", Boolean.TRUE);
|
||||
bd.getPropertyValues().add("locateExistingServerIfPossible", Boolean.TRUE);
|
||||
|
||||
// Mark as infrastructure bean and attach source location.
|
||||
bd.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
|
|
@ -85,7 +85,7 @@ class MBeanServerBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
|||
static AbstractBeanDefinition findServerForSpecialEnvironment() {
|
||||
if (weblogicPresent) {
|
||||
RootBeanDefinition bd = new RootBeanDefinition(JndiObjectFactoryBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("jndiName", "java:comp/env/jmx/runtime");
|
||||
bd.getPropertyValues().add("jndiName", "java:comp/env/jmx/runtime");
|
||||
return bd;
|
||||
}
|
||||
else if (webspherePresent) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class ScriptingDefaultsParser implements BeanDefinitionParser {
|
|||
LangNamespaceUtils.registerScriptFactoryPostProcessorIfNecessary(parserContext.getRegistry());
|
||||
String refreshCheckDelay = element.getAttribute(REFRESH_CHECK_DELAY_ATTRIBUTE);
|
||||
if (StringUtils.hasText(refreshCheckDelay)) {
|
||||
bd.getPropertyValues().addPropertyValue("defaultRefreshCheckDelay", new Long(refreshCheckDelay));
|
||||
bd.getPropertyValues().add("defaultRefreshCheckDelay", new Long(refreshCheckDelay));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@ public final class AutoProxyCreatorTests {
|
|||
sac.registerSingleton("testInterceptor", TestInterceptor.class);
|
||||
|
||||
RootBeanDefinition proxyCreator = new RootBeanDefinition(BeanNameAutoProxyCreator.class);
|
||||
proxyCreator.getPropertyValues().addPropertyValue("interceptorNames", "testInterceptor");
|
||||
proxyCreator.getPropertyValues().addPropertyValue("beanNames", "singletonToBeProxied,innerBean,singletonFactoryToBeProxied");
|
||||
proxyCreator.getPropertyValues().add("interceptorNames", "testInterceptor");
|
||||
proxyCreator.getPropertyValues().add("beanNames", "singletonToBeProxied,innerBean,singletonFactoryToBeProxied");
|
||||
sac.getDefaultListableBeanFactory().registerBeanDefinition("beanNameAutoProxyCreator", proxyCreator);
|
||||
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
RootBeanDefinition innerBean = new RootBeanDefinition(TestBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("spouse", new BeanDefinitionHolder(innerBean, "innerBean"));
|
||||
bd.getPropertyValues().add("spouse", new BeanDefinitionHolder(innerBean, "innerBean"));
|
||||
sac.getDefaultListableBeanFactory().registerBeanDefinition("singletonToBeProxied", bd);
|
||||
|
||||
sac.registerSingleton("singletonFactoryToBeProxied", DummyFactory.class);
|
||||
|
|
@ -100,8 +100,8 @@ public final class AutoProxyCreatorTests {
|
|||
sac.registerSingleton("testInterceptor", TestInterceptor.class);
|
||||
|
||||
RootBeanDefinition proxyCreator = new RootBeanDefinition(BeanNameAutoProxyCreator.class);
|
||||
proxyCreator.getPropertyValues().addPropertyValue("interceptorNames", "testInterceptor");
|
||||
proxyCreator.getPropertyValues().addPropertyValue("beanNames", "singletonToBeProxied,&singletonFactoryToBeProxied");
|
||||
proxyCreator.getPropertyValues().add("interceptorNames", "testInterceptor");
|
||||
proxyCreator.getPropertyValues().add("beanNames", "singletonToBeProxied,&singletonFactoryToBeProxied");
|
||||
sac.getDefaultListableBeanFactory().registerBeanDefinition("beanNameAutoProxyCreator", proxyCreator);
|
||||
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
|
||||
|
|
@ -182,7 +182,7 @@ public final class AutoProxyCreatorTests {
|
|||
sac.registerSingleton("testAutoProxyCreator", TestAutoProxyCreator.class);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("singleton", "false");
|
||||
pvs.add("singleton", "false");
|
||||
sac.registerSingleton("prototypeFactoryToBeProxied", DummyFactory.class, pvs);
|
||||
|
||||
sac.refresh();
|
||||
|
|
@ -205,7 +205,7 @@ public final class AutoProxyCreatorTests {
|
|||
StaticApplicationContext sac = new StaticApplicationContext();
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("proxyFactoryBean", "false");
|
||||
pvs.add("proxyFactoryBean", "false");
|
||||
sac.registerSingleton("testAutoProxyCreator", TestAutoProxyCreator.class, pvs);
|
||||
|
||||
sac.registerSingleton("singletonFactoryToBeProxied", DummyFactory.class);
|
||||
|
|
@ -236,11 +236,11 @@ public final class AutoProxyCreatorTests {
|
|||
StaticApplicationContext sac = new StaticApplicationContext();
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("proxyObject", "false");
|
||||
pvs.add("proxyObject", "false");
|
||||
sac.registerSingleton("testAutoProxyCreator", TestAutoProxyCreator.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("singleton", "false");
|
||||
pvs.add("singleton", "false");
|
||||
sac.registerSingleton("prototypeFactoryToBeProxied", DummyFactory.class, pvs);
|
||||
|
||||
sac.refresh();
|
||||
|
|
|
|||
|
|
@ -763,7 +763,7 @@ public final class XmlBeanFactoryTests {
|
|||
XmlBeanFactory xbf = new XmlBeanFactory(AUTOWIRE_CONTEXT);
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "kerry");
|
||||
pvs.add("name", "kerry");
|
||||
lbf.registerBeanDefinition("spouse", new RootBeanDefinition(TestBean.class, pvs));
|
||||
xbf.setParentBeanFactory(lbf);
|
||||
doTestAutowire(xbf);
|
||||
|
|
|
|||
|
|
@ -215,8 +215,8 @@ final class TestNamespaceHandler extends NamespaceHandlerSupport {
|
|||
definition.setBeanClass(TestBean.class);
|
||||
|
||||
MutablePropertyValues mpvs = new MutablePropertyValues();
|
||||
mpvs.addPropertyValue("name", element.getAttribute("name"));
|
||||
mpvs.addPropertyValue("age", element.getAttribute("age"));
|
||||
mpvs.add("name", element.getAttribute("name"));
|
||||
mpvs.add("age", element.getAttribute("age"));
|
||||
definition.setPropertyValues(mpvs);
|
||||
|
||||
parserContext.getRegistry().registerBeanDefinition(element.getAttribute("id"), definition);
|
||||
|
|
@ -244,8 +244,8 @@ final class TestNamespaceHandler extends NamespaceHandlerSupport {
|
|||
BeanDefinition def = definition.getBeanDefinition();
|
||||
|
||||
MutablePropertyValues mpvs = (def.getPropertyValues() == null) ? new MutablePropertyValues() : def.getPropertyValues();
|
||||
mpvs.addPropertyValue("name", element.getAttribute("name"));
|
||||
mpvs.addPropertyValue("age", element.getAttribute("age"));
|
||||
mpvs.add("name", element.getAttribute("name"));
|
||||
mpvs.add("age", element.getAttribute("age"));
|
||||
|
||||
((AbstractBeanDefinition) def).setPropertyValues(mpvs);
|
||||
return definition;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class AnnotationProcessorPerformanceTests {
|
|||
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(ResourceAnnotatedTestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
rbd.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("spouse"));
|
||||
rbd.getPropertyValues().add("spouse", new RuntimeBeanReference("spouse"));
|
||||
ctx.registerBeanDefinition("test", rbd);
|
||||
ctx.registerBeanDefinition("spouse", new RootBeanDefinition(TestBean.class));
|
||||
TestBean spouse = (TestBean) ctx.getBean("spouse");
|
||||
|
|
@ -133,7 +133,7 @@ public class AnnotationProcessorPerformanceTests {
|
|||
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(AutowiredAnnotatedTestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
rbd.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("spouse"));
|
||||
rbd.getPropertyValues().add("spouse", new RuntimeBeanReference("spouse"));
|
||||
ctx.registerBeanDefinition("test", rbd);
|
||||
ctx.registerBeanDefinition("spouse", new RootBeanDefinition(TestBean.class));
|
||||
TestBean spouse = (TestBean) ctx.getBean("spouse");
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ public class CommonAnnotationBeanPostProcessorTests {
|
|||
|
||||
RootBeanDefinition annotatedBd = new RootBeanDefinition(ExtendedResourceInjectionBean.class);
|
||||
TestBean tb5 = new TestBean();
|
||||
annotatedBd.getPropertyValues().addPropertyValue("testBean2", tb5);
|
||||
annotatedBd.getPropertyValues().add("testBean2", tb5);
|
||||
bf.registerBeanDefinition("annotatedBean", annotatedBd);
|
||||
bf.registerBeanDefinition("annotatedBean2", new RootBeanDefinition(NamedResourceInjectionBean.class));
|
||||
TestBean tb = new TestBean();
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ public class ApplicationContextEventTests {
|
|||
public void innerBeanAsListener() {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
RootBeanDefinition listenerDef = new RootBeanDefinition(TestBean.class);
|
||||
listenerDef.getPropertyValues().addPropertyValue("friends", new RootBeanDefinition(BeanThatListens.class));
|
||||
listenerDef.getPropertyValues().add("friends", new RootBeanDefinition(BeanThatListens.class));
|
||||
context.registerBeanDefinition("listener", listenerDef);
|
||||
context.refresh();
|
||||
context.publishEvent(new MyEvent(this));
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class EventPublicationInterceptorTests {
|
|||
|
||||
StaticApplicationContext ctx = new TestContext();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("applicationEventClass", TestEvent.class.getName());
|
||||
pvs.add("applicationEventClass", TestEvent.class.getName());
|
||||
// should automatically receive applicationEventPublisher reference
|
||||
ctx.registerSingleton("publisher", EventPublicationInterceptor.class, pvs);
|
||||
ctx.registerSingleton("otherListener", FactoryBeanTestListener.class);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class ApplicationContextExpressionTests {
|
|||
|
||||
GenericBeanDefinition bd0 = new GenericBeanDefinition();
|
||||
bd0.setBeanClass(TestBean.class);
|
||||
bd0.getPropertyValues().addPropertyValue("name", "myName");
|
||||
bd0.getPropertyValues().add("name", "myName");
|
||||
bd0.addQualifier(new AutowireCandidateQualifier(Qualifier.class, "original"));
|
||||
ac.registerBeanDefinition("tb0", bd0);
|
||||
|
||||
|
|
@ -100,9 +100,9 @@ public class ApplicationContextExpressionTests {
|
|||
GenericBeanDefinition bd2 = new GenericBeanDefinition();
|
||||
bd2.setBeanClass(TestBean.class);
|
||||
bd2.setScope("myScope");
|
||||
bd2.getPropertyValues().addPropertyValue("name", "{ XXX#{tb0.name}YYY#{mySpecialAttr}ZZZ }");
|
||||
bd2.getPropertyValues().addPropertyValue("age", "#{mySpecialAttr}");
|
||||
bd2.getPropertyValues().addPropertyValue("country", "${code} #{systemProperties.country}");
|
||||
bd2.getPropertyValues().add("name", "{ XXX#{tb0.name}YYY#{mySpecialAttr}ZZZ }");
|
||||
bd2.getPropertyValues().add("age", "#{mySpecialAttr}");
|
||||
bd2.getPropertyValues().add("country", "${code} #{systemProperties.country}");
|
||||
ac.registerBeanDefinition("tb2", bd2);
|
||||
|
||||
GenericBeanDefinition bd3 = new GenericBeanDefinition();
|
||||
|
|
@ -179,8 +179,8 @@ public class ApplicationContextExpressionTests {
|
|||
AnnotationConfigUtils.registerAnnotationConfigProcessors(ac);
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(PrototypeTestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
rbd.getPropertyValues().addPropertyValue("country", "#{systemProperties.country}");
|
||||
rbd.getPropertyValues().addPropertyValue("country2", new TypedStringValue("#{systemProperties.country}"));
|
||||
rbd.getPropertyValues().add("country", "#{systemProperties.country}");
|
||||
rbd.getPropertyValues().add("country2", new TypedStringValue("#{systemProperties.country}"));
|
||||
ac.registerBeanDefinition("test", rbd);
|
||||
ac.refresh();
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ public class ApplicationContextExpressionTests {
|
|||
RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class);
|
||||
rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue("#{systemProperties.name}");
|
||||
rbd.getPropertyValues().addPropertyValue("country", "#{systemProperties.country}");
|
||||
rbd.getPropertyValues().add("country", "#{systemProperties.country}");
|
||||
ac.registerBeanDefinition("test", rbd);
|
||||
ac.refresh();
|
||||
StopWatch sw = new StopWatch();
|
||||
|
|
@ -246,7 +246,7 @@ public class ApplicationContextExpressionTests {
|
|||
|
||||
GenericBeanDefinition bd = new GenericBeanDefinition();
|
||||
bd.setBeanClass(TestBean.class);
|
||||
bd.getPropertyValues().addPropertyValue("country", "#{systemProperties.country}");
|
||||
bd.getPropertyValues().add("country", "#{systemProperties.country}");
|
||||
ac.registerBeanDefinition("tb", bd);
|
||||
|
||||
SecurityManager oldSecurityManager = System.getSecurityManager();
|
||||
|
|
|
|||
|
|
@ -72,10 +72,10 @@ public class BeanFactoryPostProcessorTests {
|
|||
ac.registerSingleton("tb1", TestBean.class);
|
||||
ac.registerSingleton("tb2", TestBean.class);
|
||||
MutablePropertyValues pvs1 = new MutablePropertyValues();
|
||||
pvs1.addPropertyValue("initValue", "${key}");
|
||||
pvs1.add("initValue", "${key}");
|
||||
ac.registerSingleton("bfpp1", TestBeanFactoryPostProcessor.class, pvs1);
|
||||
MutablePropertyValues pvs2 = new MutablePropertyValues();
|
||||
pvs2.addPropertyValue("properties", "key=value");
|
||||
pvs2.add("properties", "key=value");
|
||||
ac.registerSingleton("bfpp2", PropertyPlaceholderConfigurer.class, pvs2);
|
||||
ac.refresh();
|
||||
TestBeanFactoryPostProcessor bfpp = (TestBeanFactoryPostProcessor) ac.getBean("bfpp1");
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ public class PropertyResourceConfigurerIntegrationTests {
|
|||
public void testPropertyPlaceholderConfigurerWithSystemPropertyInLocation() {
|
||||
StaticApplicationContext ac = new StaticApplicationContext();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
ac.registerSingleton("tb", TestBean.class, pvs);
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("location", "${user.dir}/test");
|
||||
pvs.add("location", "${user.dir}/test");
|
||||
ac.registerSingleton("configurer", PropertyPlaceholderConfigurer.class, pvs);
|
||||
try {
|
||||
ac.refresh();
|
||||
|
|
@ -73,10 +73,10 @@ public class PropertyResourceConfigurerIntegrationTests {
|
|||
public void testPropertyPlaceholderConfigurerWithSystemPropertiesInLocation() {
|
||||
StaticApplicationContext ac = new StaticApplicationContext();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
ac.registerSingleton("tb", TestBean.class, pvs);
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("location", "${user.dir}/test/${user.dir}");
|
||||
pvs.add("location", "${user.dir}/test/${user.dir}");
|
||||
ac.registerSingleton("configurer", PropertyPlaceholderConfigurer.class, pvs);
|
||||
try {
|
||||
ac.refresh();
|
||||
|
|
@ -102,10 +102,10 @@ public class PropertyResourceConfigurerIntegrationTests {
|
|||
public void testPropertyPlaceholderConfigurerWithUnresolvableSystemPropertiesInLocation() {
|
||||
StaticApplicationContext ac = new StaticApplicationContext();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
ac.registerSingleton("tb", TestBean.class, pvs);
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("location", "${myprop}/test/${myprop}");
|
||||
pvs.add("location", "${myprop}/test/${myprop}");
|
||||
ac.registerSingleton("configurer", PropertyPlaceholderConfigurer.class, pvs);
|
||||
try {
|
||||
ac.refresh();
|
||||
|
|
@ -121,10 +121,10 @@ public class PropertyResourceConfigurerIntegrationTests {
|
|||
public void testPropertyPlaceholderConfigurerWithMultiLevelCircularReference() {
|
||||
StaticApplicationContext ac = new StaticApplicationContext();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "name${var}");
|
||||
pvs.add("name", "name${var}");
|
||||
ac.registerSingleton("tb1", TestBean.class, pvs);
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("properties", "var=${m}var\nm=${var2}\nvar2=${var}");
|
||||
pvs.add("properties", "var=${m}var\nm=${var2}\nvar2=${var}");
|
||||
ac.registerSingleton("configurer1", PropertyPlaceholderConfigurer.class, pvs);
|
||||
try {
|
||||
ac.refresh();
|
||||
|
|
@ -139,10 +139,10 @@ public class PropertyResourceConfigurerIntegrationTests {
|
|||
public void testPropertyPlaceholderConfigurerWithNestedCircularReference() {
|
||||
StaticApplicationContext ac = new StaticApplicationContext();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "name${var}");
|
||||
pvs.add("name", "name${var}");
|
||||
ac.registerSingleton("tb1", TestBean.class, pvs);
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("properties", "var=${m}var\nm=${var2}\nvar2=${m}");
|
||||
pvs.add("properties", "var=${m}var\nm=${var2}\nvar2=${m}");
|
||||
ac.registerSingleton("configurer1", PropertyPlaceholderConfigurer.class, pvs);
|
||||
try {
|
||||
ac.refresh();
|
||||
|
|
|
|||
|
|
@ -90,15 +90,15 @@ public class ResourceBundleMessageSourceTests extends TestCase {
|
|||
basepath + "messages",
|
||||
basepath + "more-messages"};
|
||||
}
|
||||
pvs.addPropertyValue("basenames", basenames);
|
||||
pvs.add("basenames", basenames);
|
||||
if (!fallbackToSystemLocale) {
|
||||
pvs.addPropertyValue("fallbackToSystemLocale", Boolean.FALSE);
|
||||
pvs.add("fallbackToSystemLocale", Boolean.FALSE);
|
||||
}
|
||||
if (useCodeAsDefaultMessage) {
|
||||
pvs.addPropertyValue("useCodeAsDefaultMessage", Boolean.TRUE);
|
||||
pvs.add("useCodeAsDefaultMessage", Boolean.TRUE);
|
||||
}
|
||||
if (alwaysUseMessageFormat) {
|
||||
pvs.addPropertyValue("alwaysUseMessageFormat", Boolean.TRUE);
|
||||
pvs.add("alwaysUseMessageFormat", Boolean.TRUE);
|
||||
}
|
||||
Class clazz = reloadable ?
|
||||
(Class) ReloadableResourceBundleMessageSource.class : ResourceBundleMessageSource.class;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindLocalDate() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("localDate", "10/31/09");
|
||||
propertyValues.add("localDate", "10/31/09");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("10/31/09", binder.getBindingResult().getFieldValue("localDate"));
|
||||
|
|
@ -67,7 +67,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindLocalDateArray() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("localDate", new String[] { "10/31/09" });
|
||||
propertyValues.add("localDate", new String[] { "10/31/09" });
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindLocalDateAnnotated() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("localDateAnnotated", "Oct 31, 2009");
|
||||
propertyValues.add("localDateAnnotated", "Oct 31, 2009");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("Oct 31, 2009", binder.getBindingResult().getFieldValue("localDateAnnotated"));
|
||||
|
|
@ -84,7 +84,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindLocalTime() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("localTime", "12:00 PM");
|
||||
propertyValues.add("localTime", "12:00 PM");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("12:00 PM", binder.getBindingResult().getFieldValue("localTime"));
|
||||
|
|
@ -93,7 +93,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindLocalTimeAnnotated() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("localTimeAnnotated", "12:00:00 PM");
|
||||
propertyValues.add("localTimeAnnotated", "12:00:00 PM");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("12:00:00 PM", binder.getBindingResult().getFieldValue("localTimeAnnotated"));
|
||||
|
|
@ -102,7 +102,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindLocalDateTime() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("localDateTime", "10/31/09 12:00 PM");
|
||||
propertyValues.add("localDateTime", "10/31/09 12:00 PM");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("10/31/09 12:00 PM", binder.getBindingResult().getFieldValue("localDateTime"));
|
||||
|
|
@ -111,7 +111,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindLocalDateTimeAnnotated() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("localDateTimeAnnotated", "Saturday, October 31, 2009 12:00:00 PM ");
|
||||
propertyValues.add("localDateTimeAnnotated", "Saturday, October 31, 2009 12:00:00 PM ");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("Saturday, October 31, 2009 12:00:00 PM ", binder.getBindingResult().getFieldValue(
|
||||
|
|
@ -121,7 +121,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindDateTime() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("dateTime", "10/31/09 12:00 PM");
|
||||
propertyValues.add("dateTime", "10/31/09 12:00 PM");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("10/31/09 12:00 PM", binder.getBindingResult().getFieldValue("dateTime"));
|
||||
|
|
@ -130,7 +130,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindDateTimeAnnotated() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("dateTimeAnnotated", "Oct 31, 2009 12:00 PM");
|
||||
propertyValues.add("dateTimeAnnotated", "Oct 31, 2009 12:00 PM");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("Oct 31, 2009 12:00 PM", binder.getBindingResult().getFieldValue("dateTimeAnnotated"));
|
||||
|
|
@ -139,7 +139,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindDateTimeAnnotatedPattern() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("dateTimeAnnotatedPattern", "10/31/09 12:00 PM");
|
||||
propertyValues.add("dateTimeAnnotatedPattern", "10/31/09 12:00 PM");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("10/31/09 12:00 PM", binder.getBindingResult().getFieldValue("dateTimeAnnotatedPattern"));
|
||||
|
|
@ -148,7 +148,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindDateTimeAnnotatedDefault() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("dateTimeAnnotatedDefault", "10/31/09 12:00 PM");
|
||||
propertyValues.add("dateTimeAnnotatedDefault", "10/31/09 12:00 PM");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("10/31/09 12:00 PM", binder.getBindingResult().getFieldValue("dateTimeAnnotatedDefault"));
|
||||
|
|
@ -157,7 +157,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindDate() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("date", "10/31/09 12:00 PM");
|
||||
propertyValues.add("date", "10/31/09 12:00 PM");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("10/31/09 12:00 PM", binder.getBindingResult().getFieldValue("date"));
|
||||
|
|
@ -166,7 +166,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindDateAnnotated() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("dateAnnotated", "10/31/09");
|
||||
propertyValues.add("dateAnnotated", "10/31/09");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("10/31/09", binder.getBindingResult().getFieldValue("dateAnnotated"));
|
||||
|
|
@ -175,7 +175,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindCalendar() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("calendar", "10/31/09 12:00 PM");
|
||||
propertyValues.add("calendar", "10/31/09 12:00 PM");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("10/31/09 12:00 PM", binder.getBindingResult().getFieldValue("calendar"));
|
||||
|
|
@ -184,7 +184,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindCalendarAnnotated() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("calendarAnnotated", "10/31/09");
|
||||
propertyValues.add("calendarAnnotated", "10/31/09");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("10/31/09", binder.getBindingResult().getFieldValue("calendarAnnotated"));
|
||||
|
|
@ -193,7 +193,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindLong() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("millis", "1256961600");
|
||||
propertyValues.add("millis", "1256961600");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("1256961600", binder.getBindingResult().getFieldValue("millis"));
|
||||
|
|
@ -202,7 +202,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindLongAnnotated() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("millisAnnotated", "10/31/09");
|
||||
propertyValues.add("millisAnnotated", "10/31/09");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("10/31/09", binder.getBindingResult().getFieldValue("millisAnnotated"));
|
||||
|
|
@ -211,7 +211,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindISODate() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("isoDate", "2009-10-31");
|
||||
propertyValues.add("isoDate", "2009-10-31");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("2009-10-31", binder.getBindingResult().getFieldValue("isoDate"));
|
||||
|
|
@ -220,7 +220,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindISOTime() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("isoTime", "12:00:00.000-05:00");
|
||||
propertyValues.add("isoTime", "12:00:00.000-05:00");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("12:00:00.000", binder.getBindingResult().getFieldValue("isoTime"));
|
||||
|
|
@ -229,7 +229,7 @@ public class JodaTimeFormattingTests {
|
|||
@Test
|
||||
public void testBindISODateTime() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("isoDateTime", "2009-10-31T12:00:00.000Z");
|
||||
propertyValues.add("isoDateTime", "2009-10-31T12:00:00.000Z");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("2009-10-31T07:00:00.000-05:00", binder.getBindingResult().getFieldValue("isoDateTime"));
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class NumberFormattingTests {
|
|||
@Test
|
||||
public void testDefaultNumberFormatting() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("numberDefault", "3,339.12");
|
||||
propertyValues.add("numberDefault", "3,339.12");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("3,339", binder.getBindingResult().getFieldValue("numberDefault"));
|
||||
|
|
@ -47,7 +47,7 @@ public class NumberFormattingTests {
|
|||
@Test
|
||||
public void testDefaultNumberFormattingAnnotated() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("numberDefaultAnnotated", "3,339.12");
|
||||
propertyValues.add("numberDefaultAnnotated", "3,339.12");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("3,339.12", binder.getBindingResult().getFieldValue("numberDefaultAnnotated"));
|
||||
|
|
@ -56,7 +56,7 @@ public class NumberFormattingTests {
|
|||
@Test
|
||||
public void testCurrencyFormatting() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("currency", "$3,339.12");
|
||||
propertyValues.add("currency", "$3,339.12");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("$3,339.12", binder.getBindingResult().getFieldValue("currency"));
|
||||
|
|
@ -65,7 +65,7 @@ public class NumberFormattingTests {
|
|||
@Test
|
||||
public void testPercentFormatting() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("percent", "53%");
|
||||
propertyValues.add("percent", "53%");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("53%", binder.getBindingResult().getFieldValue("percent"));
|
||||
|
|
@ -74,7 +74,7 @@ public class NumberFormattingTests {
|
|||
@Test
|
||||
public void testPatternFormatting() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.addPropertyValue("pattern", "1,25.00");
|
||||
propertyValues.add("pattern", "1,25.00");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("1,25.00", binder.getBindingResult().getFieldValue("pattern"));
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class AsyncAnnotationBeanPostProcessorTests {
|
|||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setThreadNamePrefix("testExecutor");
|
||||
executor.afterPropertiesSet();
|
||||
processorDefinition.getPropertyValues().addPropertyValue("executor", executor);
|
||||
processorDefinition.getPropertyValues().add("executor", executor);
|
||||
BeanDefinition targetDefinition = new RootBeanDefinition(AsyncAnnotationBeanPostProcessorTests.TestBean.class);
|
||||
context.registerBeanDefinition("postProcessor", processorDefinition);
|
||||
context.registerBeanDefinition("target", targetDefinition);
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ public class DataBinderTests extends TestCase {
|
|||
DataBinder binder = new DataBinder(rod, "person");
|
||||
assertTrue(binder.isIgnoreUnknownFields());
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("age", "032");
|
||||
pvs.addPropertyValue("nonExisting", "someValue");
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("age", "032");
|
||||
pvs.add("nonExisting", "someValue");
|
||||
|
||||
binder.bind(pvs);
|
||||
binder.close();
|
||||
|
|
@ -92,8 +92,8 @@ public class DataBinderTests extends TestCase {
|
|||
DataBinder binder = new DataBinder(rod, "person");
|
||||
assertTrue(binder.isIgnoreUnknownFields());
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("jedi", "on");
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("jedi", "on");
|
||||
|
||||
binder.bind(pvs);
|
||||
binder.close();
|
||||
|
|
@ -107,8 +107,8 @@ public class DataBinderTests extends TestCase {
|
|||
DataBinder binder = new DataBinder(rod, "person");
|
||||
assertTrue(binder.isIgnoreUnknownFields());
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("spouse.name", "Kerry");
|
||||
pvs.addPropertyValue("spouse.jedi", "on");
|
||||
pvs.add("spouse.name", "Kerry");
|
||||
pvs.add("spouse.jedi", "on");
|
||||
|
||||
binder.bind(pvs);
|
||||
binder.close();
|
||||
|
|
@ -122,9 +122,9 @@ public class DataBinderTests extends TestCase {
|
|||
DataBinder binder = new DataBinder(rod, "person");
|
||||
binder.setIgnoreUnknownFields(false);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("age", new Integer(32));
|
||||
pvs.addPropertyValue("nonExisting", "someValue");
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("age", new Integer(32));
|
||||
pvs.add("nonExisting", "someValue");
|
||||
|
||||
try {
|
||||
binder.bind(pvs);
|
||||
|
|
@ -139,8 +139,8 @@ public class DataBinderTests extends TestCase {
|
|||
TestBean rod = new TestBean();
|
||||
DataBinder binder = new DataBinder(rod, "person");
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("spouse.age", new Integer(32));
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("spouse.age", new Integer(32));
|
||||
|
||||
try {
|
||||
binder.bind(pvs);
|
||||
|
|
@ -156,8 +156,8 @@ public class DataBinderTests extends TestCase {
|
|||
DataBinder binder = new DataBinder(rod, "person");
|
||||
binder.setIgnoreInvalidFields(true);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("spouse.age", new Integer(32));
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("spouse.age", new Integer(32));
|
||||
|
||||
binder.bind(pvs);
|
||||
}
|
||||
|
|
@ -166,9 +166,9 @@ public class DataBinderTests extends TestCase {
|
|||
TestBean rod = new TestBean();
|
||||
DataBinder binder = new DataBinder(rod, "person");
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("age", "32x");
|
||||
pvs.addPropertyValue("touchy", "m.y");
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("age", "32x");
|
||||
pvs.add("touchy", "m.y");
|
||||
binder.bind(pvs);
|
||||
|
||||
try {
|
||||
|
|
@ -215,9 +215,9 @@ public class DataBinderTests extends TestCase {
|
|||
rod = new TestBean();
|
||||
binder = new DataBinder(rod, "person");
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("age", "32x");
|
||||
pvs.addPropertyValue("touchy", "m.y");
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("age", "32x");
|
||||
pvs.add("touchy", "m.y");
|
||||
binder.bind(pvs);
|
||||
assertEquals(binder.getBindingResult(), ex.getBindingResult());
|
||||
}
|
||||
|
|
@ -243,10 +243,10 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("age", "32x");
|
||||
pvs.addPropertyValue("touchy", "m.y");
|
||||
pvs.addPropertyValue("spouse", "Kerry");
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("age", "32x");
|
||||
pvs.add("touchy", "m.y");
|
||||
pvs.add("spouse", "Kerry");
|
||||
binder.bind(pvs);
|
||||
|
||||
try {
|
||||
|
|
@ -290,7 +290,7 @@ public class DataBinderTests extends TestCase {
|
|||
DataBinder binder = new DataBinder(tb);
|
||||
binder.registerCustomEditor(Integer.class, "object", new CustomNumberEditor(Integer.class, true));
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("object", "1");
|
||||
pvs.add("object", "1");
|
||||
binder.bind(pvs);
|
||||
assertEquals(new Integer(1), tb.getObject());
|
||||
}
|
||||
|
|
@ -302,7 +302,7 @@ public class DataBinderTests extends TestCase {
|
|||
conversionService.addFormatterForFieldType(Float.class, new NumberFormatter());
|
||||
binder.setConversionService(conversionService);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("myFloat", "1,2");
|
||||
pvs.add("myFloat", "1,2");
|
||||
|
||||
LocaleContextHolder.setLocale(Locale.GERMAN);
|
||||
try {
|
||||
|
|
@ -330,8 +330,8 @@ public class DataBinderTests extends TestCase {
|
|||
DataBinder binder = new DataBinder(rod);
|
||||
binder.setAllowedFields(new String[] {"name", "myparam"});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("age", "32x");
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("age", "32x");
|
||||
|
||||
binder.bind(pvs);
|
||||
binder.close();
|
||||
|
|
@ -344,8 +344,8 @@ public class DataBinderTests extends TestCase {
|
|||
DataBinder binder = new DataBinder(rod);
|
||||
binder.setDisallowedFields(new String[] {"age"});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("age", "32x");
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("age", "32x");
|
||||
|
||||
binder.bind(pvs);
|
||||
binder.close();
|
||||
|
|
@ -362,8 +362,8 @@ public class DataBinderTests extends TestCase {
|
|||
binder.setAllowedFields(new String[] {"name", "myparam"});
|
||||
binder.setDisallowedFields(new String[] {"age"});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("age", "32x");
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("age", "32x");
|
||||
|
||||
binder.bind(pvs);
|
||||
binder.close();
|
||||
|
|
@ -380,8 +380,8 @@ public class DataBinderTests extends TestCase {
|
|||
binder.setAllowedFields(new String[] {"name", "age"});
|
||||
binder.setDisallowedFields(new String[] {"age"});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("age", "32x");
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("age", "32x");
|
||||
|
||||
binder.bind(pvs);
|
||||
binder.close();
|
||||
|
|
@ -398,9 +398,9 @@ public class DataBinderTests extends TestCase {
|
|||
binder.setAllowedFields(new String[] {"nam*", "*ouchy"});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "Rod");
|
||||
pvs.addPropertyValue("touchy", "Rod");
|
||||
pvs.addPropertyValue("age", "32x");
|
||||
pvs.add("name", "Rod");
|
||||
pvs.add("touchy", "Rod");
|
||||
pvs.add("age", "32x");
|
||||
|
||||
binder.bind(pvs);
|
||||
binder.close();
|
||||
|
|
@ -425,10 +425,10 @@ public class DataBinderTests extends TestCase {
|
|||
binder.setDisallowedFields(new String[] {"someMap['key3']", "someMap[key4]"});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("someMap[key1]", "value1");
|
||||
pvs.addPropertyValue("someMap['key2']", "value2");
|
||||
pvs.addPropertyValue("someMap[key3]", "value3");
|
||||
pvs.addPropertyValue("someMap['key4']", "value4");
|
||||
pvs.add("someMap[key1]", "value1");
|
||||
pvs.add("someMap['key2']", "value2");
|
||||
pvs.add("someMap[key3]", "value3");
|
||||
pvs.add("someMap['key4']", "value4");
|
||||
|
||||
binder.bind(pvs);
|
||||
binder.close();
|
||||
|
|
@ -453,10 +453,10 @@ public class DataBinderTests extends TestCase {
|
|||
binder.setRequiredFields(new String[] {"touchy", "name", "age", "date", "spouse.name"});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("touchy", "");
|
||||
pvs.addPropertyValue("name", null);
|
||||
pvs.addPropertyValue("age", null);
|
||||
pvs.addPropertyValue("spouse.name", " ");
|
||||
pvs.add("touchy", "");
|
||||
pvs.add("name", null);
|
||||
pvs.add("age", null);
|
||||
pvs.add("spouse.name", " ");
|
||||
|
||||
binder.bind(pvs);
|
||||
|
||||
|
|
@ -483,9 +483,9 @@ public class DataBinderTests extends TestCase {
|
|||
binder.setRequiredFields(new String[] {"someMap[key1]", "someMap[key2]", "someMap['key3']", "someMap[key4]"});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("someMap[key1]", "value1");
|
||||
pvs.addPropertyValue("someMap['key2']", "value2");
|
||||
pvs.addPropertyValue("someMap[key3]", "value3");
|
||||
pvs.add("someMap[key1]", "value1");
|
||||
pvs.add("someMap['key2']", "value2");
|
||||
pvs.add("someMap[key3]", "value3");
|
||||
|
||||
binder.bind(pvs);
|
||||
|
||||
|
|
@ -505,8 +505,8 @@ public class DataBinderTests extends TestCase {
|
|||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("spouse", "someValue");
|
||||
pvs.addPropertyValue("spouse.name", "test");
|
||||
pvs.add("spouse", "someValue");
|
||||
pvs.add("spouse.name", "test");
|
||||
binder.bind(pvs);
|
||||
|
||||
assertNotNull(tb.getSpouse());
|
||||
|
|
@ -528,9 +528,9 @@ public class DataBinderTests extends TestCase {
|
|||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "value");
|
||||
pvs.addPropertyValue("touchy", "value");
|
||||
pvs.addPropertyValue("spouse.name", "sue");
|
||||
pvs.add("name", "value");
|
||||
pvs.add("touchy", "value");
|
||||
pvs.add("spouse.name", "sue");
|
||||
binder.bind(pvs);
|
||||
|
||||
binder.getBindingResult().rejectValue("name", "someCode", "someMessage");
|
||||
|
|
@ -564,7 +564,7 @@ public class DataBinderTests extends TestCase {
|
|||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "");
|
||||
pvs.add("age", "");
|
||||
binder.bind(pvs);
|
||||
|
||||
assertEquals("argh", binder.getBindingResult().getFieldValue("age"));
|
||||
|
|
@ -585,8 +585,8 @@ public class DataBinderTests extends TestCase {
|
|||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "value");
|
||||
pvs.addPropertyValue("touchy", "value");
|
||||
pvs.add("name", "value");
|
||||
pvs.add("touchy", "value");
|
||||
binder.bind(pvs);
|
||||
|
||||
binder.getBindingResult().rejectValue("name", "someCode", "someMessage");
|
||||
|
|
@ -613,12 +613,12 @@ public class DataBinderTests extends TestCase {
|
|||
});
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "value");
|
||||
pvs.add("name", "value");
|
||||
binder.bind(pvs);
|
||||
assertEquals("value", tb.getName());
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("name", "vaLue");
|
||||
pvs.add("name", "vaLue");
|
||||
binder.bind(pvs);
|
||||
assertEquals("value", tb.getName());
|
||||
}
|
||||
|
|
@ -638,7 +638,7 @@ public class DataBinderTests extends TestCase {
|
|||
tb.setSpouse(tb2);
|
||||
DataBinder db = new DataBinder(tb, "tb");
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("spouse.age", "argh");
|
||||
pvs.add("spouse.age", "argh");
|
||||
db.bind(pvs);
|
||||
Errors errors = db.getBindingResult();
|
||||
Validator testValidator = new TestBeanValidator();
|
||||
|
|
@ -865,7 +865,7 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("set", new String[] {"10", "20", "30"});
|
||||
pvs.add("set", new String[] {"10", "20", "30"});
|
||||
binder.bind(pvs);
|
||||
|
||||
assertEquals(tb.getSet(), binder.getBindingResult().getFieldValue("set"));
|
||||
|
|
@ -876,7 +876,7 @@ public class DataBinderTests extends TestCase {
|
|||
assertTrue(tb.getSet().contains(new Integer(30)));
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("set", null);
|
||||
pvs.add("set", null);
|
||||
binder.bind(pvs);
|
||||
|
||||
assertNull(tb.getSet());
|
||||
|
|
@ -887,7 +887,7 @@ public class DataBinderTests extends TestCase {
|
|||
DataBinder binder = new DataBinder(tb, "tb");
|
||||
binder.registerCustomEditor(Set.class, new CustomCollectionEditor(TreeSet.class, true));
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("set", null);
|
||||
pvs.add("set", null);
|
||||
binder.bind(pvs);
|
||||
|
||||
assertTrue(tb.getSet() instanceof TreeSet);
|
||||
|
|
@ -903,7 +903,7 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0]", "a");
|
||||
pvs.add("array[0]", "a");
|
||||
binder.bind(pvs);
|
||||
Errors errors = binder.getBindingResult();
|
||||
errors.rejectValue("array[0].name", "NOT_ROD", "are you sure you're not Rod?");
|
||||
|
|
@ -942,7 +942,7 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].nestedIndexedBean.list[0].name", "a");
|
||||
pvs.add("array[0].nestedIndexedBean.list[0].name", "a");
|
||||
binder.bind(pvs);
|
||||
Errors errors = binder.getBindingResult();
|
||||
errors.rejectValue("array[0].nestedIndexedBean.list[0].name", "NOT_ROD", "are you sure you're not Rod?");
|
||||
|
|
@ -981,8 +981,8 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].nestedIndexedBean.list[0].name", "test1");
|
||||
pvs.addPropertyValue("array[1].nestedIndexedBean.list[1].name", "test2");
|
||||
pvs.add("array[0].nestedIndexedBean.list[0].name", "test1");
|
||||
pvs.add("array[1].nestedIndexedBean.list[1].name", "test2");
|
||||
binder.bind(pvs);
|
||||
assertEquals("listtest1", ((TestBean) tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName());
|
||||
assertEquals("listtest2", ((TestBean) tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName());
|
||||
|
|
@ -1004,8 +1004,8 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].nestedIndexedBean.list[0].name", "test1");
|
||||
pvs.addPropertyValue("array[1].nestedIndexedBean.list[1].name", "test2");
|
||||
pvs.add("array[0].nestedIndexedBean.list[0].name", "test1");
|
||||
pvs.add("array[1].nestedIndexedBean.list[1].name", "test2");
|
||||
binder.bind(pvs);
|
||||
assertEquals("listtest1", ((TestBean) tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName());
|
||||
assertEquals("test2", ((TestBean) tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName());
|
||||
|
|
@ -1027,8 +1027,8 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0].nestedIndexedBean.list[0].name", "test1");
|
||||
pvs.addPropertyValue("array[1].nestedIndexedBean.list[1].name", "test2");
|
||||
pvs.add("array[0].nestedIndexedBean.list[0].name", "test1");
|
||||
pvs.add("array[1].nestedIndexedBean.list[1].name", "test2");
|
||||
binder.bind(pvs);
|
||||
assertEquals("listtest1", ((TestBean) tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName());
|
||||
assertEquals("test2", ((TestBean) tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName());
|
||||
|
|
@ -1050,7 +1050,7 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0]", "a");
|
||||
pvs.add("array[0]", "a");
|
||||
binder.bind(pvs);
|
||||
Errors errors = binder.getBindingResult();
|
||||
errors.rejectValue("array[0]", "NOT_ROD", "are you sure you're not Rod?");
|
||||
|
|
@ -1156,7 +1156,7 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("array[0]", "a");
|
||||
pvs.add("array[0]", "a");
|
||||
binder.bind(pvs);
|
||||
Errors errors = binder.getBindingResult();
|
||||
errors.rejectValue("array[0]", "NOT_ROD", "are you sure you're not Rod?");
|
||||
|
|
@ -1182,7 +1182,7 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("stringArray", "a1-b2");
|
||||
pvs.add("stringArray", "a1-b2");
|
||||
binder.bind(pvs);
|
||||
assertTrue(!binder.getBindingResult().hasErrors());
|
||||
assertEquals(2, tb.getStringArray().length);
|
||||
|
|
@ -1199,7 +1199,7 @@ public class DataBinderTests extends TestCase {
|
|||
}
|
||||
});
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("stringArray", new String[] {"a1", "b2"});
|
||||
pvs.add("stringArray", new String[] {"a1", "b2"});
|
||||
binder.bind(pvs);
|
||||
assertTrue(!binder.getBindingResult().hasErrors());
|
||||
assertEquals(2, tb.getStringArray().length);
|
||||
|
|
@ -1211,7 +1211,7 @@ public class DataBinderTests extends TestCase {
|
|||
TestBean rod = new TestBean();
|
||||
DataBinder binder = new DataBinder(rod, "person");
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "32x");
|
||||
pvs.add("age", "32x");
|
||||
binder.bind(pvs);
|
||||
Errors errors = binder.getBindingResult();
|
||||
FieldError ageError = errors.getFieldError("age");
|
||||
|
|
@ -1237,7 +1237,7 @@ public class DataBinderTests extends TestCase {
|
|||
TestBean rod = new TestBean();
|
||||
DataBinder binder = new DataBinder(rod, "person");
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "32x");
|
||||
pvs.add("age", "32x");
|
||||
binder.bind(pvs);
|
||||
Errors errors = binder.getBindingResult();
|
||||
|
||||
|
|
@ -1257,8 +1257,8 @@ public class DataBinderTests extends TestCase {
|
|||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
TestBean tb1 = new TestBean("tb1", 99);
|
||||
TestBean tb2 = new TestBean("tb2", 99);
|
||||
pvs.addPropertyValue("list[0]", tb1);
|
||||
pvs.addPropertyValue("list[1]", tb2);
|
||||
pvs.add("list[0]", tb1);
|
||||
pvs.add("list[1]", tb2);
|
||||
binder.bind(pvs);
|
||||
assertEquals(tb1.getName(), binder.getBindingResult().getFieldValue("list[0].name"));
|
||||
assertEquals(tb2.getName(), binder.getBindingResult().getFieldValue("list[1].name"));
|
||||
|
|
@ -1322,8 +1322,8 @@ public class DataBinderTests extends TestCase {
|
|||
String beanName = "foobar";
|
||||
|
||||
MutablePropertyValues mpvs = new MutablePropertyValues();
|
||||
mpvs.addPropertyValue("name", name);
|
||||
mpvs.addPropertyValue("beanName", beanName);
|
||||
mpvs.add("name", name);
|
||||
mpvs.add("beanName", beanName);
|
||||
|
||||
binder.bind(mpvs);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.core.convert.converter;
|
||||
|
||||
import org.springframework.core.convert.TypeDescriptor;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.core.convert.support;
|
||||
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
"Listener 'ref' attribute contains empty value.", listenerEle);
|
||||
}
|
||||
else {
|
||||
listenerDef.getPropertyValues().addPropertyValue("delegate", new RuntimeBeanReference(ref));
|
||||
listenerDef.getPropertyValues().add("delegate", new RuntimeBeanReference(ref));
|
||||
}
|
||||
|
||||
String method = null;
|
||||
|
|
@ -127,7 +127,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
"Listener 'method' attribute contains empty value.", listenerEle);
|
||||
}
|
||||
}
|
||||
listenerDef.getPropertyValues().addPropertyValue("defaultListenerMethod", method);
|
||||
listenerDef.getPropertyValues().add("defaultListenerMethod", method);
|
||||
|
||||
if (containerEle.hasAttribute(MESSAGE_CONVERTER_ATTRIBUTE)) {
|
||||
String messageConverter = containerEle.getAttribute(MESSAGE_CONVERTER_ATTRIBUTE);
|
||||
|
|
@ -136,7 +136,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
"Listener container 'message-converter' attribute contains empty value.", containerEle);
|
||||
}
|
||||
else {
|
||||
listenerDef.getPropertyValues().addPropertyValue("messageConverter",
|
||||
listenerDef.getPropertyValues().add("messageConverter",
|
||||
new RuntimeBeanReference(messageConverter));
|
||||
}
|
||||
}
|
||||
|
|
@ -146,10 +146,10 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
if (listenerEle.hasAttribute(RESPONSE_DESTINATION_ATTRIBUTE)) {
|
||||
String responseDestination = listenerEle.getAttribute(RESPONSE_DESTINATION_ATTRIBUTE);
|
||||
boolean pubSubDomain = indicatesPubSub(containerDef);
|
||||
listenerDef.getPropertyValues().addPropertyValue(
|
||||
listenerDef.getPropertyValues().add(
|
||||
pubSubDomain ? "defaultResponseTopicName" : "defaultResponseQueueName", responseDestination);
|
||||
if (containerDef.getPropertyValues().contains("destinationResolver")) {
|
||||
listenerDef.getPropertyValues().addPropertyValue("destinationResolver",
|
||||
listenerDef.getPropertyValues().add("destinationResolver",
|
||||
containerDef.getPropertyValues().getPropertyValue("destinationResolver").getValue());
|
||||
}
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
listenerDef.setBeanClassName(
|
||||
"org.springframework.jms.listener.adapter.MessageListenerAdapter" + (jms102 ? "102" : ""));
|
||||
|
||||
containerDef.getPropertyValues().addPropertyValue("messageListener", listenerDef);
|
||||
containerDef.getPropertyValues().add("messageListener", listenerDef);
|
||||
|
||||
String containerBeanName = listenerEle.getAttribute(ID_ATTRIBUTE);
|
||||
// If no bean id is given auto generate one using the ReaderContext's BeanNameGenerator
|
||||
|
|
@ -188,7 +188,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
parserContext.getReaderContext().error(
|
||||
"Listener 'destination' attribute contains empty value.", ele);
|
||||
}
|
||||
configDef.getPropertyValues().addPropertyValue("destinationName", destination);
|
||||
configDef.getPropertyValues().add("destinationName", destination);
|
||||
|
||||
if (ele.hasAttribute(SUBSCRIPTION_ATTRIBUTE)) {
|
||||
String subscription = ele.getAttribute(SUBSCRIPTION_ATTRIBUTE);
|
||||
|
|
@ -196,7 +196,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
parserContext.getReaderContext().error(
|
||||
"Listener 'subscription' attribute contains empty value.", ele);
|
||||
}
|
||||
configDef.getPropertyValues().addPropertyValue("durableSubscriptionName", subscription);
|
||||
configDef.getPropertyValues().add("durableSubscriptionName", subscription);
|
||||
}
|
||||
|
||||
if (ele.hasAttribute(SELECTOR_ATTRIBUTE)) {
|
||||
|
|
@ -205,7 +205,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
parserContext.getReaderContext().error(
|
||||
"Listener 'selector' attribute contains empty value.", ele);
|
||||
}
|
||||
configDef.getPropertyValues().addPropertyValue("messageSelector", selector);
|
||||
configDef.getPropertyValues().add("messageSelector", selector);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -227,8 +227,8 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
parserContext.getReaderContext().error("Invalid listener container 'destination-type': " +
|
||||
"only \"queue\", \"topic\" and \"durableTopic\" supported.", ele);
|
||||
}
|
||||
configDef.getPropertyValues().addPropertyValue("pubSubDomain", pubSubDomain);
|
||||
configDef.getPropertyValues().addPropertyValue("subscriptionDurable", subscriptionDurable);
|
||||
configDef.getPropertyValues().add("pubSubDomain", pubSubDomain);
|
||||
configDef.getPropertyValues().add("subscriptionDurable", subscriptionDurable);
|
||||
|
||||
if (ele.hasAttribute(CLIENT_ID_ATTRIBUTE)) {
|
||||
String clientId = ele.getAttribute(CLIENT_ID_ATTRIBUTE);
|
||||
|
|
@ -236,7 +236,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
|||
parserContext.getReaderContext().error(
|
||||
"Listener 'client-id' attribute contains empty value.", ele);
|
||||
}
|
||||
configDef.getPropertyValues().addPropertyValue("clientId", clientId);
|
||||
configDef.getPropertyValues().add("clientId", clientId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class JcaListenerContainerParser extends AbstractListenerContainerParser {
|
|||
"Listener container 'resource-adapter' attribute contains empty value.", containerEle);
|
||||
}
|
||||
else {
|
||||
containerDef.getPropertyValues().addPropertyValue("resourceAdapter",
|
||||
containerDef.getPropertyValues().add("resourceAdapter",
|
||||
new RuntimeBeanReference(resourceAdapterBeanName));
|
||||
}
|
||||
}
|
||||
|
|
@ -62,11 +62,11 @@ class JcaListenerContainerParser extends AbstractListenerContainerParser {
|
|||
"'destination-resolver', not both. If you define a dedicated JmsActivationSpecFactory bean, " +
|
||||
"specify the custom DestinationResolver there (if possible).", containerEle);
|
||||
}
|
||||
containerDef.getPropertyValues().addPropertyValue("activationSpecFactory",
|
||||
containerDef.getPropertyValues().add("activationSpecFactory",
|
||||
new RuntimeBeanReference(activationSpecFactoryBeanName));
|
||||
}
|
||||
if (StringUtils.hasText(destinationResolverBeanName)) {
|
||||
containerDef.getPropertyValues().addPropertyValue("destinationResolver",
|
||||
containerDef.getPropertyValues().add("destinationResolver",
|
||||
new RuntimeBeanReference(destinationResolverBeanName));
|
||||
}
|
||||
|
||||
|
|
@ -79,26 +79,26 @@ class JcaListenerContainerParser extends AbstractListenerContainerParser {
|
|||
|
||||
Integer acknowledgeMode = parseAcknowledgeMode(containerEle, parserContext);
|
||||
if (acknowledgeMode != null) {
|
||||
configDef.getPropertyValues().addPropertyValue("acknowledgeMode", acknowledgeMode);
|
||||
configDef.getPropertyValues().add("acknowledgeMode", acknowledgeMode);
|
||||
}
|
||||
|
||||
String transactionManagerBeanName = containerEle.getAttribute(TRANSACTION_MANAGER_ATTRIBUTE);
|
||||
if (StringUtils.hasText(transactionManagerBeanName)) {
|
||||
containerDef.getPropertyValues().addPropertyValue("transactionManager",
|
||||
containerDef.getPropertyValues().add("transactionManager",
|
||||
new RuntimeBeanReference(transactionManagerBeanName));
|
||||
}
|
||||
|
||||
int[] concurrency = parseConcurrency(containerEle, parserContext);
|
||||
if (concurrency != null) {
|
||||
configDef.getPropertyValues().addPropertyValue("maxConcurrency", concurrency[1]);
|
||||
configDef.getPropertyValues().add("maxConcurrency", concurrency[1]);
|
||||
}
|
||||
|
||||
String prefetch = containerEle.getAttribute(PREFETCH_ATTRIBUTE);
|
||||
if (StringUtils.hasText(prefetch)) {
|
||||
configDef.getPropertyValues().addPropertyValue("prefetchSize", new Integer(prefetch));
|
||||
configDef.getPropertyValues().add("prefetchSize", new Integer(prefetch));
|
||||
}
|
||||
|
||||
containerDef.getPropertyValues().addPropertyValue("activationSpecConfig", configDef);
|
||||
containerDef.getPropertyValues().add("activationSpecConfig", configDef);
|
||||
|
||||
return containerDef;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,25 +85,25 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
|
|||
}
|
||||
}
|
||||
if (StringUtils.hasText(connectionFactoryBeanName)) {
|
||||
containerDef.getPropertyValues().addPropertyValue("connectionFactory",
|
||||
containerDef.getPropertyValues().add("connectionFactory",
|
||||
new RuntimeBeanReference(connectionFactoryBeanName));
|
||||
}
|
||||
|
||||
String taskExecutorBeanName = containerEle.getAttribute(TASK_EXECUTOR_ATTRIBUTE);
|
||||
if (StringUtils.hasText(taskExecutorBeanName)) {
|
||||
containerDef.getPropertyValues().addPropertyValue("taskExecutor",
|
||||
containerDef.getPropertyValues().add("taskExecutor",
|
||||
new RuntimeBeanReference(taskExecutorBeanName));
|
||||
}
|
||||
|
||||
String errorHandlerBeanName = containerEle.getAttribute(ERROR_HANDLER_ATTRIBUTE);
|
||||
if (StringUtils.hasText(errorHandlerBeanName)) {
|
||||
containerDef.getPropertyValues().addPropertyValue("errorHandler",
|
||||
containerDef.getPropertyValues().add("errorHandler",
|
||||
new RuntimeBeanReference(errorHandlerBeanName));
|
||||
}
|
||||
|
||||
String destinationResolverBeanName = containerEle.getAttribute(DESTINATION_RESOLVER_ATTRIBUTE);
|
||||
if (StringUtils.hasText(destinationResolverBeanName)) {
|
||||
containerDef.getPropertyValues().addPropertyValue("destinationResolver",
|
||||
containerDef.getPropertyValues().add("destinationResolver",
|
||||
new RuntimeBeanReference(destinationResolverBeanName));
|
||||
}
|
||||
|
||||
|
|
@ -117,17 +117,17 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
|
|||
}
|
||||
}
|
||||
else {
|
||||
containerDef.getPropertyValues().addPropertyValue("cacheLevelName", "CACHE_" + cache.toUpperCase());
|
||||
containerDef.getPropertyValues().add("cacheLevelName", "CACHE_" + cache.toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
Integer acknowledgeMode = parseAcknowledgeMode(containerEle, parserContext);
|
||||
if (acknowledgeMode != null) {
|
||||
if (acknowledgeMode == Session.SESSION_TRANSACTED) {
|
||||
containerDef.getPropertyValues().addPropertyValue("sessionTransacted", Boolean.TRUE);
|
||||
containerDef.getPropertyValues().add("sessionTransacted", Boolean.TRUE);
|
||||
}
|
||||
else {
|
||||
containerDef.getPropertyValues().addPropertyValue("sessionAcknowledgeMode", acknowledgeMode);
|
||||
containerDef.getPropertyValues().add("sessionAcknowledgeMode", acknowledgeMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
|
|||
"'transaction-manager' attribute not supported for listener container of type \"simple\".", containerEle);
|
||||
}
|
||||
else {
|
||||
containerDef.getPropertyValues().addPropertyValue("transactionManager",
|
||||
containerDef.getPropertyValues().add("transactionManager",
|
||||
new RuntimeBeanReference(transactionManagerBeanName));
|
||||
}
|
||||
}
|
||||
|
|
@ -146,18 +146,18 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
|
|||
int[] concurrency = parseConcurrency(containerEle, parserContext);
|
||||
if (concurrency != null) {
|
||||
if (containerType.startsWith("default")) {
|
||||
containerDef.getPropertyValues().addPropertyValue("concurrentConsumers", concurrency[0]);
|
||||
containerDef.getPropertyValues().addPropertyValue("maxConcurrentConsumers", concurrency[1]);
|
||||
containerDef.getPropertyValues().add("concurrentConsumers", concurrency[0]);
|
||||
containerDef.getPropertyValues().add("maxConcurrentConsumers", concurrency[1]);
|
||||
}
|
||||
else {
|
||||
containerDef.getPropertyValues().addPropertyValue("concurrentConsumers", concurrency[1]);
|
||||
containerDef.getPropertyValues().add("concurrentConsumers", concurrency[1]);
|
||||
}
|
||||
}
|
||||
|
||||
String prefetch = containerEle.getAttribute(PREFETCH_ATTRIBUTE);
|
||||
if (StringUtils.hasText(prefetch)) {
|
||||
if (containerType.startsWith("default")) {
|
||||
containerDef.getPropertyValues().addPropertyValue("maxMessagesPerTask", new Integer(prefetch));
|
||||
containerDef.getPropertyValues().add("maxMessagesPerTask", new Integer(prefetch));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public class PersistenceInjectionTests extends AbstractEntityManagerFactoryBeanT
|
|||
gac.registerBeanDefinition("annotationProcessor",
|
||||
new RootBeanDefinition(PersistenceAnnotationBeanPostProcessor.class));
|
||||
RootBeanDefinition bd = new RootBeanDefinition(DefaultPublicPersistenceContextSetter.class);
|
||||
bd.getPropertyValues().addPropertyValue("entityManager", mockEm2);
|
||||
bd.getPropertyValues().add("entityManager", mockEm2);
|
||||
gac.registerBeanDefinition(DefaultPublicPersistenceContextSetter.class.getName(), bd);
|
||||
gac.refresh();
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ public class PersistenceInjectionTests extends AbstractEntityManagerFactoryBeanT
|
|||
gac.registerBeanDefinition("annotationProcessor",
|
||||
new RootBeanDefinition(PersistenceAnnotationBeanPostProcessor.class));
|
||||
RootBeanDefinition bd = new RootBeanDefinition(DefaultPublicPersistenceUnitSetter.class);
|
||||
bd.getPropertyValues().addPropertyValue("emf", mockEmf2);
|
||||
bd.getPropertyValues().add("emf", mockEmf2);
|
||||
gac.registerBeanDefinition(DefaultPublicPersistenceUnitSetter.class.getName(), bd);
|
||||
gac.refresh();
|
||||
|
||||
|
|
@ -246,7 +246,7 @@ public class PersistenceInjectionTests extends AbstractEntityManagerFactoryBeanT
|
|||
gac.getDefaultListableBeanFactory().registerSingleton("entityManagerFactory2", mockEmf2);
|
||||
gac.registerAlias("entityManagerFactory2", "Person");
|
||||
RootBeanDefinition processorDef = new RootBeanDefinition(PersistenceAnnotationBeanPostProcessor.class);
|
||||
processorDef.getPropertyValues().addPropertyValue("defaultPersistenceUnitName", "entityManagerFactory");
|
||||
processorDef.getPropertyValues().add("defaultPersistenceUnitName", "entityManagerFactory");
|
||||
gac.registerBeanDefinition("annotationProcessor", processorDef);
|
||||
gac.registerBeanDefinition(DefaultPublicPersistenceUnitSetter.class.getName(),
|
||||
new RootBeanDefinition(DefaultPublicPersistenceUnitSetter.class));
|
||||
|
|
@ -273,7 +273,7 @@ public class PersistenceInjectionTests extends AbstractEntityManagerFactoryBeanT
|
|||
gac.getDefaultListableBeanFactory().registerSingleton("entityManagerFactory", mockEmf);
|
||||
gac.getDefaultListableBeanFactory().registerSingleton("entityManagerFactory2", mockEmf2);
|
||||
RootBeanDefinition processorDef = new RootBeanDefinition(PersistenceAnnotationBeanPostProcessor.class);
|
||||
processorDef.getPropertyValues().addPropertyValue("defaultPersistenceUnitName", "entityManagerFactory");
|
||||
processorDef.getPropertyValues().add("defaultPersistenceUnitName", "entityManagerFactory");
|
||||
gac.registerBeanDefinition("annotationProcessor", processorDef);
|
||||
gac.registerBeanDefinition(DefaultPublicPersistenceUnitSetter.class.getName(),
|
||||
new RootBeanDefinition(DefaultPublicPersistenceUnitSetter.class));
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
|||
}
|
||||
|
||||
private static void registerTransactionManager(Element element, BeanDefinition def) {
|
||||
def.getPropertyValues().addPropertyValue("transactionManagerBeanName",
|
||||
def.getPropertyValues().add("transactionManagerBeanName",
|
||||
TxNamespaceHandler.getTransactionManagerName(element));
|
||||
}
|
||||
|
||||
|
|
@ -119,17 +119,17 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
|||
interceptorDef.setSource(eleSource);
|
||||
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
registerTransactionManager(element, interceptorDef);
|
||||
interceptorDef.getPropertyValues().addPropertyValue("transactionAttributeSource", new RuntimeBeanReference(sourceName));
|
||||
interceptorDef.getPropertyValues().add("transactionAttributeSource", new RuntimeBeanReference(sourceName));
|
||||
String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);
|
||||
|
||||
// Create the TransactionAttributeSourceAdvisor definition.
|
||||
RootBeanDefinition advisorDef = new RootBeanDefinition(BeanFactoryTransactionAttributeSourceAdvisor.class);
|
||||
advisorDef.setSource(eleSource);
|
||||
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
advisorDef.getPropertyValues().addPropertyValue("transactionAttributeSource", new RuntimeBeanReference(sourceName));
|
||||
advisorDef.getPropertyValues().addPropertyValue("adviceBeanName", interceptorName);
|
||||
advisorDef.getPropertyValues().add("transactionAttributeSource", new RuntimeBeanReference(sourceName));
|
||||
advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
|
||||
if (element.hasAttribute("order")) {
|
||||
advisorDef.getPropertyValues().addPropertyValue("order", element.getAttribute("order"));
|
||||
advisorDef.getPropertyValues().add("order", element.getAttribute("order"));
|
||||
}
|
||||
parserContext.getRegistry().registerBeanDefinition(TRANSACTION_ADVISOR_BEAN_NAME, advisorDef);
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ class TxAdviceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
|||
|
||||
RootBeanDefinition attributeSourceDefinition = new RootBeanDefinition(NameMatchTransactionAttributeSource.class);
|
||||
attributeSourceDefinition.setSource(parserContext.extractSource(attrEle));
|
||||
attributeSourceDefinition.getPropertyValues().addPropertyValue(NAME_MAP, transactionAttributeMap);
|
||||
attributeSourceDefinition.getPropertyValues().add(NAME_MAP, transactionAttributeMap);
|
||||
return attributeSourceDefinition;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,8 +123,8 @@ public class ComplexPortletApplicationContext extends StaticPortletApplicationCo
|
|||
Map portletModeMap = new ManagedMap();
|
||||
portletModeMap.put("view", new RuntimeBeanReference("viewController"));
|
||||
portletModeMap.put("edit", new RuntimeBeanReference("editController"));
|
||||
pvs.addPropertyValue("portletModeMap", portletModeMap);
|
||||
pvs.addPropertyValue("interceptors", interceptors);
|
||||
pvs.add("portletModeMap", portletModeMap);
|
||||
pvs.add("interceptors", interceptors);
|
||||
registerSingleton("handlerMapping3", PortletModeHandlerMapping.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
|
|
@ -137,9 +137,9 @@ public class ComplexPortletApplicationContext extends StaticPortletApplicationCo
|
|||
parameterMap.put("exception2", new RuntimeBeanReference("exceptionThrowingHandler2"));
|
||||
parameterMap.put("myPortlet", new RuntimeBeanReference("myPortlet"));
|
||||
parameterMap.put("unknown", new RuntimeBeanReference("unknownHandler"));
|
||||
pvs.addPropertyValue("parameterMap", parameterMap);
|
||||
pvs.addPropertyValue("parameterName", "myParam");
|
||||
pvs.addPropertyValue("order", "2");
|
||||
pvs.add("parameterMap", parameterMap);
|
||||
pvs.add("parameterName", "myParam");
|
||||
pvs.add("order", "2");
|
||||
registerSingleton("handlerMapping2", ParameterHandlerMapping.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
|
|
@ -148,28 +148,28 @@ public class ComplexPortletApplicationContext extends StaticPortletApplicationCo
|
|||
innerMap.put("help2", new RuntimeBeanReference("helpController2"));
|
||||
Map outerMap = new ManagedMap();
|
||||
outerMap.put("help", innerMap);
|
||||
pvs.addPropertyValue("portletModeParameterMap", outerMap);
|
||||
pvs.addPropertyValue("order", "1");
|
||||
pvs.add("portletModeParameterMap", outerMap);
|
||||
pvs.add("order", "1");
|
||||
registerSingleton("handlerMapping1", PortletModeParameterHandlerMapping.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("order", "1");
|
||||
pvs.addPropertyValue("exceptionMappings",
|
||||
pvs.add("order", "1");
|
||||
pvs.add("exceptionMappings",
|
||||
"java.lang.IllegalAccessException=failed-illegalaccess\n" +
|
||||
"PortletRequestBindingException=failed-binding\n" +
|
||||
"UnavailableException=failed-unavailable");
|
||||
pvs.addPropertyValue("defaultErrorView", "failed-default-1");
|
||||
pvs.add("defaultErrorView", "failed-default-1");
|
||||
registerSingleton("exceptionResolver", SimpleMappingExceptionResolver.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("order", "0");
|
||||
pvs.addPropertyValue("exceptionMappings",
|
||||
pvs.add("order", "0");
|
||||
pvs.add("exceptionMappings",
|
||||
"java.lang.Exception=failed-exception\n" +
|
||||
"java.lang.RuntimeException=failed-runtime");
|
||||
List mappedHandlers = new ManagedList();
|
||||
mappedHandlers.add(new RuntimeBeanReference("exceptionThrowingHandler1"));
|
||||
pvs.addPropertyValue("mappedHandlers", mappedHandlers);
|
||||
pvs.addPropertyValue("defaultErrorView", "failed-default-0");
|
||||
pvs.add("mappedHandlers", mappedHandlers);
|
||||
pvs.add("defaultErrorView", "failed-default-0");
|
||||
registerSingleton("handlerExceptionResolver", SimpleMappingExceptionResolver.class, pvs);
|
||||
|
||||
addMessage("test", Locale.ENGLISH, "test message");
|
||||
|
|
|
|||
|
|
@ -46,19 +46,19 @@ public class SimplePortletApplicationContext extends StaticPortletApplicationCon
|
|||
registerSingleton("controller1", TestFormController.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("bindOnNewForm", "true");
|
||||
pvs.add("bindOnNewForm", "true");
|
||||
registerSingleton("controller2", TestFormController.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("requireSession", "true");
|
||||
pvs.addPropertyValue("sessionForm", "true");
|
||||
pvs.addPropertyValue("bindOnNewForm", "true");
|
||||
pvs.add("requireSession", "true");
|
||||
pvs.add("sessionForm", "true");
|
||||
pvs.add("bindOnNewForm", "true");
|
||||
registerSingleton("controller3", TestFormController.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("requireSession", "true");
|
||||
pvs.addPropertyValue("sessionForm", "true");
|
||||
pvs.addPropertyValue("bindOnNewForm", "false");
|
||||
pvs.add("requireSession", "true");
|
||||
pvs.add("sessionForm", "true");
|
||||
pvs.add("bindOnNewForm", "false");
|
||||
registerSingleton("controller4", TestFormController.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ public final class PortletWrappingControllerTests {
|
|||
|
||||
public void refresh() throws BeansException {
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("portletClass", MyPortlet.class);
|
||||
pvs.add("portletClass", MyPortlet.class);
|
||||
registerSingleton(PORTLET_WRAPPING_CONTROLLER_BEAN_NAME, PortletWrappingController.class, pvs);
|
||||
super.refresh();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ public class Portlet20AnnotationControllerTests {
|
|||
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
||||
wac.registerBeanDefinition("controller", new RootBeanDefinition(MyCommandProvidingFormController.class));
|
||||
RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
|
||||
adapterDef.getPropertyValues().addPropertyValue("webBindingInitializer", new MyWebBindingInitializer());
|
||||
adapterDef.getPropertyValues().add("webBindingInitializer", new MyWebBindingInitializer());
|
||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
@ -250,8 +250,8 @@ public class Portlet20AnnotationControllerTests {
|
|||
wac.registerBeanDefinition("controller", new RootBeanDefinition(MyTypedCommandProvidingFormController.class));
|
||||
wac.registerBeanDefinition("controller2", new RootBeanDefinition(MyOtherTypedCommandProvidingFormController.class));
|
||||
RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
|
||||
adapterDef.getPropertyValues().addPropertyValue("webBindingInitializer", new MyWebBindingInitializer());
|
||||
adapterDef.getPropertyValues().addPropertyValue("customArgumentResolver", new MySpecialArgumentResolver());
|
||||
adapterDef.getPropertyValues().add("webBindingInitializer", new MyWebBindingInitializer());
|
||||
adapterDef.getPropertyValues().add("customArgumentResolver", new MySpecialArgumentResolver());
|
||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ public class PortletAnnotationControllerTests extends TestCase {
|
|||
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
||||
wac.registerBeanDefinition("controller", new RootBeanDefinition(MyCommandProvidingFormController.class));
|
||||
RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
|
||||
adapterDef.getPropertyValues().addPropertyValue("webBindingInitializer", new MyWebBindingInitializer());
|
||||
adapterDef.getPropertyValues().add("webBindingInitializer", new MyWebBindingInitializer());
|
||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
@ -228,8 +228,8 @@ public class PortletAnnotationControllerTests extends TestCase {
|
|||
wac.registerBeanDefinition("controller", new RootBeanDefinition(MyTypedCommandProvidingFormController.class));
|
||||
wac.registerBeanDefinition("controller2", new RootBeanDefinition(MyOtherTypedCommandProvidingFormController.class));
|
||||
RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
|
||||
adapterDef.getPropertyValues().addPropertyValue("webBindingInitializer", new MyWebBindingInitializer());
|
||||
adapterDef.getPropertyValues().addPropertyValue("customArgumentResolver", new MySpecialArgumentResolver());
|
||||
adapterDef.getPropertyValues().add("webBindingInitializer", new MyWebBindingInitializer());
|
||||
adapterDef.getPropertyValues().add("customArgumentResolver", new MySpecialArgumentResolver());
|
||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
@ -448,7 +448,7 @@ public class PortletAnnotationControllerTests extends TestCase {
|
|||
new RootBeanDefinition(ModelAndViewResolverController.class));
|
||||
RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
|
||||
adapterDef.getPropertyValues()
|
||||
.addPropertyValue("customModelAndViewResolver", new MyModelAndViewResolver());
|
||||
.add("customModelAndViewResolver", new MyModelAndViewResolver());
|
||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class ServletContextSupportTests {
|
|||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
wac.setServletContext(sc);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("attributeName", "myAttr");
|
||||
pvs.add("attributeName", "myAttr");
|
||||
wac.registerSingleton("importedAttr", ServletContextAttributeFactoryBean.class, pvs);
|
||||
wac.refresh();
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ public class ServletContextSupportTests {
|
|||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
wac.setServletContext(sc);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("attributeName", "myAttr");
|
||||
pvs.add("attributeName", "myAttr");
|
||||
wac.registerSingleton("importedAttr", ServletContextAttributeFactoryBean.class, pvs);
|
||||
|
||||
try {
|
||||
|
|
@ -109,7 +109,7 @@ public class ServletContextSupportTests {
|
|||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
wac.setServletContext(sc);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("initParamName", "myParam");
|
||||
pvs.add("initParamName", "myParam");
|
||||
wac.registerSingleton("importedParam", ServletContextParameterFactoryBean.class, pvs);
|
||||
wac.refresh();
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ public class ServletContextSupportTests {
|
|||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
wac.setServletContext(sc);
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("initParamName", "myParam");
|
||||
pvs.add("initParamName", "myParam");
|
||||
wac.registerSingleton("importedParam", ServletContextParameterFactoryBean.class, pvs);
|
||||
|
||||
try {
|
||||
|
|
@ -163,16 +163,16 @@ public class ServletContextSupportTests {
|
|||
wac.setServletContext(sc);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "${age}");
|
||||
pvs.addPropertyValue("name", "${key4}name${var}${var}${");
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.add("age", "${age}");
|
||||
pvs.add("name", "${key4}name${var}${var}${");
|
||||
pvs.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
wac.registerSingleton("tb1", TestBean.class, pvs);
|
||||
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, null);
|
||||
wac.getDefaultListableBeanFactory().registerBeanDefinition("tb2", bd);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("properties", "age=98\nvar=${m}var\nref=tb2\nm=my");
|
||||
pvs.add("properties", "age=98\nvar=${m}var\nref=tb2\nm=my");
|
||||
wac.registerSingleton("configurer", ServletContextPropertyPlaceholderConfigurer.class, pvs);
|
||||
|
||||
wac.refresh();
|
||||
|
|
@ -193,16 +193,16 @@ public class ServletContextSupportTests {
|
|||
wac.setServletContext(sc);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "${age}");
|
||||
pvs.addPropertyValue("name", "${key4}name${var}${var}${");
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.add("age", "${age}");
|
||||
pvs.add("name", "${key4}name${var}${var}${");
|
||||
pvs.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
wac.registerSingleton("tb1", TestBean.class, pvs);
|
||||
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, null);
|
||||
wac.getDefaultListableBeanFactory().registerBeanDefinition("tb2", bd);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("properties", "age=98\nvar=${m}var\nref=tb2\nm=my\nkey4=yourkey4");
|
||||
pvs.add("properties", "age=98\nvar=${m}var\nref=tb2\nm=my\nkey4=yourkey4");
|
||||
wac.registerSingleton("configurer", ServletContextPropertyPlaceholderConfigurer.class, pvs);
|
||||
|
||||
wac.refresh();
|
||||
|
|
@ -223,17 +223,17 @@ public class ServletContextSupportTests {
|
|||
wac.setServletContext(sc);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "${age}");
|
||||
pvs.addPropertyValue("name", "${key4}name${var}${var}${");
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.add("age", "${age}");
|
||||
pvs.add("name", "${key4}name${var}${var}${");
|
||||
pvs.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
wac.registerSingleton("tb1", TestBean.class, pvs);
|
||||
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, null);
|
||||
wac.getDefaultListableBeanFactory().registerBeanDefinition("tb2", bd);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("properties", "age=98\nvar=${m}var\nref=tb2\nm=my\nkey4=yourkey4");
|
||||
pvs.addPropertyValue("contextOverride", Boolean.TRUE);
|
||||
pvs.add("properties", "age=98\nvar=${m}var\nref=tb2\nm=my\nkey4=yourkey4");
|
||||
pvs.add("contextOverride", Boolean.TRUE);
|
||||
wac.registerSingleton("configurer", ServletContextPropertyPlaceholderConfigurer.class, pvs);
|
||||
|
||||
wac.refresh();
|
||||
|
|
@ -255,18 +255,18 @@ public class ServletContextSupportTests {
|
|||
wac.setServletContext(sc);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "${age}");
|
||||
pvs.addPropertyValue("name", "${key4}name${var}${var}${");
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.add("age", "${age}");
|
||||
pvs.add("name", "${key4}name${var}${var}${");
|
||||
pvs.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
wac.registerSingleton("tb1", TestBean.class, pvs);
|
||||
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, null);
|
||||
wac.getDefaultListableBeanFactory().registerBeanDefinition("tb2", bd);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("properties", "age=98\nvar=${m}var\nref=tb2\nm=my\nkey4=yourkey4");
|
||||
pvs.addPropertyValue("contextOverride", Boolean.TRUE);
|
||||
pvs.addPropertyValue("searchContextAttributes", Boolean.TRUE);
|
||||
pvs.add("properties", "age=98\nvar=${m}var\nref=tb2\nm=my\nkey4=yourkey4");
|
||||
pvs.add("contextOverride", Boolean.TRUE);
|
||||
pvs.add("searchContextAttributes", Boolean.TRUE);
|
||||
wac.registerSingleton("configurer", ServletContextPropertyPlaceholderConfigurer.class, pvs);
|
||||
|
||||
wac.refresh();
|
||||
|
|
@ -287,9 +287,9 @@ public class ServletContextSupportTests {
|
|||
wac.setServletContext(sc);
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("age", "${age}");
|
||||
pvs.addPropertyValue("name", "name${var}${var}${");
|
||||
pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
|
||||
pvs.add("age", "${age}");
|
||||
pvs.add("name", "name${var}${var}${");
|
||||
pvs.add("spouse", new RuntimeBeanReference("${ref}"));
|
||||
wac.registerSingleton("tb1", TestBean.class, pvs);
|
||||
|
||||
ConstructorArgumentValues cas = new ConstructorArgumentValues();
|
||||
|
|
@ -300,29 +300,29 @@ public class ServletContextSupportTests {
|
|||
List<Object> friends = new ManagedList<Object>();
|
||||
friends.add("na${age}me");
|
||||
friends.add(new RuntimeBeanReference("${ref}"));
|
||||
pvs.addPropertyValue("friends", friends);
|
||||
pvs.add("friends", friends);
|
||||
|
||||
Set<Object> someSet = new ManagedSet<Object>();
|
||||
someSet.add("na${age}me");
|
||||
someSet.add(new RuntimeBeanReference("${ref}"));
|
||||
pvs.addPropertyValue("someSet", someSet);
|
||||
pvs.add("someSet", someSet);
|
||||
|
||||
Map<String, Object> someMap = new ManagedMap<String, Object>();
|
||||
someMap.put("key1", new RuntimeBeanReference("${ref}"));
|
||||
someMap.put("key2", "${age}name");
|
||||
MutablePropertyValues innerPvs = new MutablePropertyValues();
|
||||
innerPvs.addPropertyValue("touchy", "${os.name}");
|
||||
innerPvs.add("touchy", "${os.name}");
|
||||
someMap.put("key3", new RootBeanDefinition(TestBean.class, innerPvs));
|
||||
MutablePropertyValues innerPvs2 = new MutablePropertyValues(innerPvs);
|
||||
someMap.put("${key4}", new BeanDefinitionHolder(new ChildBeanDefinition("tb1", innerPvs2), "child"));
|
||||
pvs.addPropertyValue("someMap", someMap);
|
||||
pvs.add("someMap", someMap);
|
||||
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, cas, pvs);
|
||||
wac.getDefaultListableBeanFactory().registerBeanDefinition("tb2", bd);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("properties", "var=${m}var\nref=tb2\nm=my");
|
||||
pvs.addPropertyValue("searchContextAttributes", Boolean.TRUE);
|
||||
pvs.add("properties", "var=${m}var\nref=tb2\nm=my");
|
||||
pvs.add("searchContextAttributes", Boolean.TRUE);
|
||||
wac.registerSingleton("configurer", ServletContextPropertyPlaceholderConfigurer.class, pvs);
|
||||
sc.setAttribute("age", new Integer(98));
|
||||
|
||||
|
|
|
|||
|
|
@ -97,22 +97,22 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
|
|||
interceptors.add(new MyWebRequestInterceptor());
|
||||
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue(
|
||||
pvs.add(
|
||||
"mappings", "/view.do=viewHandler\n/locale.do=localeHandler\nloc.do=anotherLocaleHandler");
|
||||
pvs.addPropertyValue("interceptors", interceptors);
|
||||
pvs.add("interceptors", interceptors);
|
||||
registerSingleton("myUrlMapping1", SimpleUrlHandlerMapping.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue(
|
||||
pvs.add(
|
||||
"mappings", "/form.do=localeHandler\n/unknown.do=unknownHandler\nservlet.do=myServlet");
|
||||
pvs.addPropertyValue("order", "2");
|
||||
pvs.add("order", "2");
|
||||
registerSingleton("myUrlMapping2", SimpleUrlHandlerMapping.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue(
|
||||
pvs.add(
|
||||
"mappings", "/form.do=formHandler\n/head.do=headController\n" +
|
||||
"body.do=bodyController\n/noview*=noviewController\n/noview/simple*=noviewController");
|
||||
pvs.addPropertyValue("order", "1");
|
||||
pvs.add("order", "1");
|
||||
registerSingleton("handlerMapping", SimpleUrlHandlerMapping.class, pvs);
|
||||
|
||||
registerSingleton("myDummyAdapter", MyDummyAdapter.class);
|
||||
|
|
@ -121,21 +121,21 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
|
|||
registerSingleton("noviewController", NoViewController.class);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("order", new Integer(0));
|
||||
pvs.addPropertyValue("basename", "org.springframework.web.servlet.complexviews");
|
||||
pvs.add("order", new Integer(0));
|
||||
pvs.add("basename", "org.springframework.web.servlet.complexviews");
|
||||
registerSingleton("viewResolver", ResourceBundleViewResolver.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("suffix", ".jsp");
|
||||
pvs.add("suffix", ".jsp");
|
||||
registerSingleton("viewResolver2", InternalResourceViewResolver.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("commandClass", "org.springframework.beans.TestBean");
|
||||
pvs.addPropertyValue("formView", "form");
|
||||
pvs.add("commandClass", "org.springframework.beans.TestBean");
|
||||
pvs.add("formView", "form");
|
||||
registerSingleton("formHandler", SimpleFormController.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("viewName", "form");
|
||||
pvs.add("viewName", "form");
|
||||
registerSingleton("viewHandler", ParameterizableViewController.class, pvs);
|
||||
|
||||
registerSingleton("localeHandler", ComplexLocaleChecker.class);
|
||||
|
|
@ -150,21 +150,21 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
|
|||
registerSingleton("myServlet", MyServlet.class);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("order", "1");
|
||||
pvs.addPropertyValue("exceptionMappings",
|
||||
pvs.add("order", "1");
|
||||
pvs.add("exceptionMappings",
|
||||
"java.lang.IllegalAccessException=failed2\n" +
|
||||
"ServletRequestBindingException=failed3");
|
||||
pvs.addPropertyValue("defaultErrorView", "failed0");
|
||||
pvs.add("defaultErrorView", "failed0");
|
||||
registerSingleton("exceptionResolver1", SimpleMappingExceptionResolver.class, pvs);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("order", "0");
|
||||
pvs.addPropertyValue("exceptionMappings", "java.lang.Exception=failed1");
|
||||
pvs.add("order", "0");
|
||||
pvs.add("exceptionMappings", "java.lang.Exception=failed1");
|
||||
List mappedHandlers = new ManagedList();
|
||||
mappedHandlers.add(new RuntimeBeanReference("anotherLocaleHandler"));
|
||||
pvs.addPropertyValue("mappedHandlers", mappedHandlers);
|
||||
pvs.addPropertyValue("defaultStatusCode", "500");
|
||||
pvs.addPropertyValue("defaultErrorView", "failed2");
|
||||
pvs.add("mappedHandlers", mappedHandlers);
|
||||
pvs.add("defaultStatusCode", "500");
|
||||
pvs.add("defaultErrorView", "failed2");
|
||||
registerSingleton("handlerExceptionResolver", SimpleMappingExceptionResolver.class, pvs);
|
||||
|
||||
registerSingleton("multipartResolver", MockMultipartResolver.class);
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ public class SimpleWebApplicationContext extends StaticWebApplicationContext {
|
|||
|
||||
public void refresh() throws BeansException {
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("commandClass", "org.springframework.beans.TestBean");
|
||||
pvs.addPropertyValue("formView", "form");
|
||||
pvs.add("commandClass", "org.springframework.beans.TestBean");
|
||||
pvs.add("formView", "form");
|
||||
registerSingleton("/form.do", SimpleFormController.class, pvs);
|
||||
|
||||
registerSingleton("/locale.do", LocaleChecker.class);
|
||||
|
|
@ -66,7 +66,7 @@ public class SimpleWebApplicationContext extends StaticWebApplicationContext {
|
|||
registerSingleton("viewResolver", InternalResourceViewResolver.class);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
pvs.addPropertyValue("location", "org/springframework/web/context/WEB-INF/sessionContext.xml");
|
||||
pvs.add("location", "org/springframework/web/context/WEB-INF/sessionContext.xml");
|
||||
registerSingleton("viewResolver2", XmlViewResolver.class, pvs);
|
||||
|
||||
super.refresh();
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
|
||||
import org.springframework.web.bind.support.WebArgumentResolver;
|
||||
import org.springframework.web.bind.support.WebBindingInitializer;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
|
@ -270,7 +269,7 @@ public class ServletAnnotationControllerTests {
|
|||
wac.registerBeanDefinition("controller",
|
||||
new RootBeanDefinition(EmptyParameterListHandlerMethodController.class));
|
||||
RootBeanDefinition vrDef = new RootBeanDefinition(InternalResourceViewResolver.class);
|
||||
vrDef.getPropertyValues().addPropertyValue("suffix", ".jsp");
|
||||
vrDef.getPropertyValues().add("suffix", ".jsp");
|
||||
wac.registerBeanDefinition("viewResolver", vrDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
@ -342,7 +341,7 @@ public class ServletAnnotationControllerTests {
|
|||
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
||||
wac.registerBeanDefinition("controller", new RootBeanDefinition(controllerClass));
|
||||
RootBeanDefinition ppc = new RootBeanDefinition(PropertyPlaceholderConfigurer.class);
|
||||
ppc.getPropertyValues().addPropertyValue("properties", "myKey=foo");
|
||||
ppc.getPropertyValues().add("properties", "myKey=foo");
|
||||
wac.registerBeanDefinition("ppc", ppc);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
@ -469,7 +468,7 @@ public class ServletAnnotationControllerTests {
|
|||
new RootBeanDefinition(MyCommandProvidingFormController.class));
|
||||
wac.registerBeanDefinition("viewResolver", new RootBeanDefinition(TestViewResolver.class));
|
||||
RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
|
||||
adapterDef.getPropertyValues().addPropertyValue("webBindingInitializer", new MyWebBindingInitializer());
|
||||
adapterDef.getPropertyValues().add("webBindingInitializer", new MyWebBindingInitializer());
|
||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
@ -496,8 +495,8 @@ public class ServletAnnotationControllerTests {
|
|||
new RootBeanDefinition(MyTypedCommandProvidingFormController.class));
|
||||
wac.registerBeanDefinition("viewResolver", new RootBeanDefinition(TestViewResolver.class));
|
||||
RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
|
||||
adapterDef.getPropertyValues().addPropertyValue("webBindingInitializer", new MyWebBindingInitializer());
|
||||
adapterDef.getPropertyValues().addPropertyValue("customArgumentResolver", new MySpecialArgumentResolver());
|
||||
adapterDef.getPropertyValues().add("webBindingInitializer", new MyWebBindingInitializer());
|
||||
adapterDef.getPropertyValues().add("customArgumentResolver", new MySpecialArgumentResolver());
|
||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
@ -748,7 +747,7 @@ public class ServletAnnotationControllerTests {
|
|||
InternalPathMethodNameResolver methodNameResolver = new InternalPathMethodNameResolver();
|
||||
methodNameResolver.setSuffix("Handle");
|
||||
RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
|
||||
adapterDef.getPropertyValues().addPropertyValue("methodNameResolver", methodNameResolver);
|
||||
adapterDef.getPropertyValues().add("methodNameResolver", methodNameResolver);
|
||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
@ -784,7 +783,7 @@ public class ServletAnnotationControllerTests {
|
|||
protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
|
||||
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
||||
RootBeanDefinition mapping = new RootBeanDefinition(ControllerClassNameHandlerMapping.class);
|
||||
mapping.getPropertyValues().addPropertyValue("excludedPackages", null);
|
||||
mapping.getPropertyValues().add("excludedPackages", null);
|
||||
wac.registerBeanDefinition("handlerMapping", mapping);
|
||||
wac.registerBeanDefinition("controller", new RootBeanDefinition(MethodNameDispatchingController.class));
|
||||
wac.refresh();
|
||||
|
|
@ -1009,7 +1008,7 @@ public class ServletAnnotationControllerTests {
|
|||
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
||||
wac.registerBeanDefinition("controller", new RootBeanDefinition(RequestBodyController.class));
|
||||
RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
|
||||
adapterDef.getPropertyValues().addPropertyValue("messageConverters", new MyMessageConverter());
|
||||
adapterDef.getPropertyValues().add("messageConverters", new MyMessageConverter());
|
||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
@ -1064,7 +1063,7 @@ public class ServletAnnotationControllerTests {
|
|||
new RootBeanDefinition(ModelAndViewResolverController.class));
|
||||
RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
|
||||
adapterDef.getPropertyValues()
|
||||
.addPropertyValue("customModelAndViewResolver", new MyModelAndViewResolver());
|
||||
.add("customModelAndViewResolver", new MyModelAndViewResolver());
|
||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ public class UriTemplateServletAnnotationControllerTests {
|
|||
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
||||
wac.registerBeanDefinition("controller", new RootBeanDefinition(ImplicitSubPathController.class));
|
||||
RootBeanDefinition mappingDef = new RootBeanDefinition(DefaultAnnotationHandlerMapping.class);
|
||||
mappingDef.getPropertyValues().addPropertyValue("useDefaultSuffixPattern", false);
|
||||
mappingDef.getPropertyValues().add("useDefaultSuffixPattern", false);
|
||||
wac.registerBeanDefinition("handlerMapping", mappingDef);
|
||||
wac.refresh();
|
||||
return wac;
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ public class WebDataBinder extends DataBinder {
|
|||
if (pv.getName().startsWith(fieldDefaultPrefix)) {
|
||||
String field = pv.getName().substring(fieldDefaultPrefix.length());
|
||||
if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) {
|
||||
mpvs.addPropertyValue(field, pv.getValue());
|
||||
mpvs.add(field, pv.getValue());
|
||||
}
|
||||
mpvs.removePropertyValue(pv);
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ public class WebDataBinder extends DataBinder {
|
|||
String field = pv.getName().substring(fieldMarkerPrefix.length());
|
||||
if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) {
|
||||
Class fieldType = getPropertyAccessor().getPropertyType(field);
|
||||
mpvs.addPropertyValue(field, getEmptyValue(field, fieldType));
|
||||
mpvs.add(field, getEmptyValue(field, fieldType));
|
||||
}
|
||||
mpvs.removePropertyValue(pv);
|
||||
}
|
||||
|
|
@ -282,7 +282,7 @@ public class WebDataBinder extends DataBinder {
|
|||
String key = entry.getKey();
|
||||
MultipartFile value = entry.getValue();
|
||||
if (isBindEmptyMultipartFiles() || !value.isEmpty()) {
|
||||
mpvs.addPropertyValue(key, value);
|
||||
mpvs.add(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,25 +48,25 @@ public class JaxWsSupportTests extends TestCase {
|
|||
|
||||
GenericBeanDefinition exporterDef = new GenericBeanDefinition();
|
||||
exporterDef.setBeanClass(SimpleJaxWsServiceExporter.class);
|
||||
exporterDef.getPropertyValues().addPropertyValue("baseAddress", "http://localhost:9999/");
|
||||
exporterDef.getPropertyValues().add("baseAddress", "http://localhost:9999/");
|
||||
ac.registerBeanDefinition("exporter", exporterDef);
|
||||
|
||||
GenericBeanDefinition clientDef = new GenericBeanDefinition();
|
||||
clientDef.setBeanClass(JaxWsPortProxyFactoryBean.class);
|
||||
clientDef.getPropertyValues().addPropertyValue("wsdlDocumentUrl", "http://localhost:9999/OrderService?wsdl");
|
||||
clientDef.getPropertyValues().addPropertyValue("namespaceUri", "http://jaxws.remoting.springframework.org/");
|
||||
clientDef.getPropertyValues().addPropertyValue("username", "juergen");
|
||||
clientDef.getPropertyValues().addPropertyValue("password", "hoeller");
|
||||
clientDef.getPropertyValues().addPropertyValue("serviceName", "OrderService");
|
||||
clientDef.getPropertyValues().addPropertyValue("serviceInterface", OrderService.class);
|
||||
clientDef.getPropertyValues().addPropertyValue("lookupServiceOnStartup", Boolean.FALSE);
|
||||
clientDef.getPropertyValues().add("wsdlDocumentUrl", "http://localhost:9999/OrderService?wsdl");
|
||||
clientDef.getPropertyValues().add("namespaceUri", "http://jaxws.remoting.springframework.org/");
|
||||
clientDef.getPropertyValues().add("username", "juergen");
|
||||
clientDef.getPropertyValues().add("password", "hoeller");
|
||||
clientDef.getPropertyValues().add("serviceName", "OrderService");
|
||||
clientDef.getPropertyValues().add("serviceInterface", OrderService.class);
|
||||
clientDef.getPropertyValues().add("lookupServiceOnStartup", Boolean.FALSE);
|
||||
ac.registerBeanDefinition("client", clientDef);
|
||||
|
||||
GenericBeanDefinition serviceFactoryDef = new GenericBeanDefinition();
|
||||
serviceFactoryDef.setBeanClass(LocalJaxWsServiceFactoryBean.class);
|
||||
serviceFactoryDef.getPropertyValues().addPropertyValue("wsdlDocumentUrl", "http://localhost:9999/OrderService?wsdl");
|
||||
serviceFactoryDef.getPropertyValues().addPropertyValue("namespaceUri", "http://jaxws.remoting.springframework.org/");
|
||||
serviceFactoryDef.getPropertyValues().addPropertyValue("serviceName", "OrderService");
|
||||
serviceFactoryDef.getPropertyValues().add("wsdlDocumentUrl", "http://localhost:9999/OrderService?wsdl");
|
||||
serviceFactoryDef.getPropertyValues().add("namespaceUri", "http://jaxws.remoting.springframework.org/");
|
||||
serviceFactoryDef.getPropertyValues().add("serviceName", "OrderService");
|
||||
ac.registerBeanDefinition("orderService", serviceFactoryDef);
|
||||
|
||||
ac.registerBeanDefinition("accessor", new RootBeanDefinition(ServiceAccessor.class));
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class RequestAndSessionScopedProxyTests extends TestCase {
|
|||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
|
||||
bd.setScope(WebApplicationContext.SCOPE_REQUEST);
|
||||
bd.getPropertyValues().addPropertyValue("name", "abc");
|
||||
bd.getPropertyValues().add("name", "abc");
|
||||
wac.registerBeanDefinition(targetBeanName, bd);
|
||||
wac.refresh();
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ public class RequestAndSessionScopedProxyTests extends TestCase {
|
|||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
|
||||
bd.setScope(WebApplicationContext.SCOPE_SESSION);
|
||||
bd.getPropertyValues().addPropertyValue("name", "abc");
|
||||
bd.getPropertyValues().add("name", "abc");
|
||||
wac.registerBeanDefinition(targetBeanName, bd);
|
||||
wac.refresh();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue