Open Source ProjectsCode that Might be Useful to You

Talks I've GivenOn Technologies and Ideas

ThoughtsWhere I Sometimes Write Things

Resume If You Believe In Those

Follow Me On

GitHubIf coding is your thing

TwitterIf you tweet

Annoyances when specifying property values in Spring

Can you spot any issues with specifying a value like this:

<bean id="casProxyTicketValidator" 
  <property name="casValidate">
  <property name="proxyCallbackUrl">
  <property name="serviceProperties">
    <ref bean="serviceProperties" />

See the value of proxyCallbackUrl? Because of the way it’s spaced, it ends up getting newlines and spaces in the value. This issue caused me quite a headache today.

One way to address would be to make sure <value> immediately surrounds the actual value. But there’s actually a cleaner syntax for doing this. It also has the benefit of being more succinct. Here’s what it looks like after being fixed:

<bean id="casProxyTicketValidator"
  <property name="casValidate" value="https://localhost:8443/cas/proxyValidate"/>
  <property name="proxyCallbackUrl" value="http://localhost:8085/cbip/casProxy/receptor"/>
  <property name="serviceProperties" ref="serviceProperties"/>

Much better, right?

comments powered by Disqus