2

I would like to populate transport End points via properties file. I tried this but it didn't work

<util:properties id="cxfProperties" location="/WEB-INF/classes/cxf.properties" />

<util:list id="transportEndpoints">
    <!--
    <value>http://localhost:8080/doubleit/services/doubleit.*</value>
    -->
    <value>#{cxfProperties.service.wsdllocation}</value>
</util:list>

In my properties file I have

service.wsdllocation=http://localhost:8080/doubleit/services/doubleit.*

I get error:

Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 14): Field or property 'service' cannot be found on object of type 'java.util.Properties'

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
TastyCode
  • 5,679
  • 4
  • 37
  • 42

1 Answers1

2

I don't think SpEL provides direct field access syntax for property in Properties. So I think the correct syntax should be:

#{cxfProperties.getProperty('service.wsdllocation')}

or

#{cxfProperties.getProperty('service.wsdllocation', 'SOME_DEFAULT_VAL')}
Adrian Shum
  • 38,812
  • 10
  • 83
  • 131
  • I get following error with it: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 14): Field or property 'service' cannot be found on object of type 'java.util.Properties' – TastyCode Dec 13 '13 at 17:00
  • are you sure that you are using the new expressions I gave? Because in my expressions, there is no navigation of field/property of `service` anymore, which contradicts to your error message. You may have simply used your old expression. – Adrian Shum Dec 16 '13 at 01:27
  • Have just created a testing project, and my suggestion is working as expected. – Adrian Shum Dec 16 '13 at 03:55