views:

171

answers:

1

I'm trying to reference another object I've defined in a Spring config file from within an expression. Specifically, I'm trying to populate a property with the value of an expression where I call a method and then a property on 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 I have defined in a config file such as:

<object id="Some.Object.Id" ... >

but my app fails to start with the parsing exception "expecting "COLON", found '}'". I think it's expecting a namespace, but I'm not finding the documentation for this.

I've tried several things, but everywhere I hit a dead end. I originally tried a combination of the MethodInvokingFactoryObject and PropertyRetrievingFactoryObject which we use in other places for non-nullable types, but this fails for nullables that are actually null since Spring sees an object factory returning null as a failure (which it usually is).

A: 

Changing # to $ should fix it, I believe.

Jonatan Lindén