Can you copy constructor-arg properties or values ​​from objects in Spring.NET XML?

I believe I stumbled upon this a couple of months ago, but now I am having a hard time finding an answer. Perhaps someone can just point me to the section I want in the documentation ?

Using Sprint.NET , I am bundling remote XML files into one application context, where the engine objects are decoupled from the business rule objects. The problem is that some business rules are values, not objects that are needed by nodes <property>

and <constructor-arg>

in the xml engine:

<object name="Engine">
    <constructor-arg index="0" value="business rule" />
</object>

      

Any reference to a property of another object (use expression

attribute instead of value

?) Or perhaps some specialized list of names / values ​​(like Spring version before <appsettings>

, whatever) will work.

+1


source to share


1 answer


Found! Starting at page 41 of the Spring Framework document (version 1.2.0 M1) under IoC Container:

5.3.8. Setting up a link using elements of other objects and classes.

This section describes those configuration scenarios that involve setting properties and constructor arguments using members of other objects and classes. This kind of scenario is pretty common, especially when it comes to legacy classes that you cannot (or will not) change for Spring .NET conventions ... consider the case of a class that has a constructor argument that can only be calculated by saying base data. The MethodInvokingFactoryObject handlers are exactly this scenario ... this will allow you to enter the result of an arbitrary method call into a constructor (as an argument) or as the value of a setter property. By analogy, PropertyRetrievingFactoryObject and FieldRetrievingFactoryObject allow you to retrieve values ​​from another object property or field value. These classes implement the IFactoryObject Interface.which points out to Spring.NET that this object itself is a factory, and factories, not a factory, is what will be associated with the object's id. factory objects are discussed later in the section.



This is 5.3.9.1 in the latest online documentation .

0


source







All Articles