I've got a context file that contains a bean with required constructor args=
=20
that I'd like to pull from a properties file which works fine with=20
PropertyPlaceholderConfigurer. However, I also have other bean properties=
=20
that specify sane defaults and which I'd like to be able to override with=20
definitions in PropertyOverrideConfigurer. Ideally I want to use the same=
=20
properties file for both.
This fails because the overrider throws an exception when trying to set=20
props used as constructor args (no bean named 'input' is defined); ie
beans.xml..
<bean id=3D"foo" class=3D"com.foo.Foo">
<constructor-arg index=3D"0"><value>${input.file}</value></constructor-ar=
g>
<property name=3D"propOne"><value>myDefault</value></property>
</bean>
props..
input.file=3D/home/darren/some.file
foo.propOne=3Dsome-other-value
This would work if for instance overrider simply logged a message that no=20
bean was found rather than throwing an exception, but that could be=20
ambiguous if a bean named 'input' WAS defined.
Any way around this other than using a props-required and a props-optional=
=20
file which isn't very nice?
=2D-=20
Darren Davison
Public Key: #DD356B0D
|