Archive for the ‘Cornel's Blog’ Category

Looking for a ${property}

Monday, August 24th, 2009

“Location, Location, Location” may not be enough.

Having property files loaded using ProperyPlaceholderConfigurer bean or the modern <context:property-placeholder> can become a real pain when the placeholders are distributed among the jars.

<context:property-placeholder location=”classpath*:*.properties”/>

Well, only location can be set here, the rest is default. Pretty cool, but it is not doing it… We look back to the old fashion bean

<bean class=”org.springframework.beans.factory.config.PropertyPlaceholderConfigurer”>
<property name=”locations” value=”classpath:*.properties”/>
</bean>

The hack comes here: change from the default placeholderPrefix to a specific one, unique among jars used and everything is gonna be alright.

<property name=”placeholderPrefix” value=”£{”/>

Don’t forget now to change the references to the properties (from ${…} to £{…}).

Source 1 Source 2

<bean id=”clientPropertyConfigurer” class=”org.springframework.beans.factory.config.PropertyPlaceholderConfigurer”>
<property name=”searchSystemEnvironment” value=”true”/>
<property name=”systemPropertiesMode” value=”2″/>
<property name=”order” value=”100″/>
<property name=”properties”>
<props>
<prop key=”BPB_SERVICES_HOST”>bpb-services01</prop>
<prop key=”BPB_SERVICES_HOST_PORT”>1099</prop>
</props>
</property>
<property name=”placeholderPrefix” value=”#{”/>
</bean>

Spring User Group speaker icebreaker

Wednesday, August 12th, 2009

The ice has been broken. The first step on the path to future speeches has been taken.

First of all I would like to thank each and every one in the audience for the great support. You can now download the demo source code and the OSGi presentation material.

You can also download Dr David Syer’s Spring Batch presentation.

Videos and photos from the event will be uploaded to our website and to the upcoming Cake blogs, so keep an eye on us.