Spring .NET Expression referencing object definition
I am trying to reference another object that I have defined in my Spring config file from an expression. Specifically, I am trying to populate a property with the value of the expression in which I am calling the method, and then the property of the object returned from that method.
I've tried the following (names have been changed):
<property name="NullableIntProperty"
expression="#{Some.Object.Id}.Get().NullableIntValue"/>
where Some.Object.Id
is a reference to another object that I defined in the config file, for example:
<object id="Some.Object.Id" ... >
but my app doesn't start with a parse exception expecting "COLON", found '}'
. I think it expects a namespace, but I can't find any documentation for that.
I've tried several things, but everywhere I am stumped. I originally tried a combination of MethodInvokingFactoryObject
and PropertyRetrievingFactoryObject
, which we use elsewhere for nullable types, but this fails for nullable values, which is actually null
because Spring sees a factory object returning null
as a failure (which it usually is).
source to share
Expression syntax @(object-id-here)
can be used to retrieve an object from a Spring context using an expression :
<property name="NullableIntProperty"
expression="@(Some.Object.Id).PropertyOnSomeObject"/>
source to share