|
From: Colin S. <col...@ex...> - 2003-11-21 16:09:06
|
(diverting to dev list, as this is more appropriate there)
This would be of some use.
Of course, the variant to adding more and more mechanisms to access
other objects is to put in some (optional) support for an expresion
language inside the bean factory. I've been thinking about this for a
while now.
So assuming that there is a generic expression language plugin facility,
and which expression language to use is denoted by a prefix, a
hypothetical OGNL example for your case would be:
<bean id="myBean" class="org.me.myClass">
<property
name="myProp"><expr>ognl:@System@getProperties()['my.property.name']</expr></property>
</bean>
And if you expose the current factory into the OGNL context, then you
could have expressions such as:
<bean id="myBean" class="org.me.myClass">
<property
name="myProp"><expr>ognl:factory.getBean('another-bean-id').someProperty</expr></property>
</bean>
and so on...
Eric Pederson wrote:
> It would be very handy to be able to set bean properties based on the
> value of system properties. That would allow system
> administrators to set application properties without touching a .war
> or .jar that has an applicationContext.xml or
> PropertyResourceConfigurer property file inside of it.
>
> For example, I would start up my JVM with a flag -Dmy.property.name=foo
>
> The applicationContent.xml in the .war or .jar would have
>
> <bean id="myBean" class="org.me.myClass">
> <property
> name="myProp"><sysproperty>my.property.name</sysproperty></property>
> </bean>
>
> This would set myBean.myProp to "foo".
>
> Thoughts?
>
>
>
> Eric Pederson
> eri...@ac...
|