PropertyOverrideConfigurer Class
Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

PropertyOverrideConfigurer Class

Overrides default values in one or more object definitions.

For a list of all members of this type, see PropertyOverrideConfigurer Members .


[Visual Basic]
<Serializable> _
Public Class PropertyOverrideConfigurer
    Inherits PropertyResourceConfigurer
public class PropertyOverrideConfigurer : PropertyResourceConfigurer

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.


Instances of this class override already existing values, and is thus best suited to replacing defaults. If you need to replace placeholder values, consider using the class instead.

In contrast to the PropertyPlaceholderConfigurer class, the original object definition can have default values or no values at all for such object properties. If an overriding configuration file does not have an entry for a certain object property, the default object value is left as is. Also note that it is not immediately obvious to discern which object definitions will be mutated by one or more PropertyOverrideConfigurers simply by looking at the object configuration.

Each line in a referenced configuration file is expected to take the following form...

  <add key="" value="the override" />

The key refers to the object name and the property that is to be overridden; and the value is the overridding value that will be inserted into the appropriate object definition's named property.

Please note that in the case of multiple PropertyOverrideConfigurers that define different values for the same object definition value, the last overridden value will win (due to the fact that the values supplied by previous PropertyOverrideConfigurers will be overridden).


The following XML context definition defines an object that has a number of properties, all of which have default values...

  <object id="connStringProvider" type="MyNamespace.OracleConnectionStringProvider, MyAssembly">
    <property name="dataSource" value="MyOracleDB" />
    <property name="userId" value="sa" />
    <property name="password" value="g0ly4dk1n" />
    <property name="integratedSecurity" value="true" />

What follows is a .NET config file snippet for the above example (assuming the need to override one of the default values)...

    <add key="database.userid" value="test" />
    <add key="database.password" value="0bl0m0v" />


Namespace: Spring.Objects.Factory.Config

Assembly: Spring.Core (in Spring.Core.dll)

See Also

PropertyOverrideConfigurer Members | Spring.Objects.Factory.Config Namespace | PropertyResourceConfigurer | PropertyPlaceholderConfigurer | IObjectDefinition