How do you refer to parameters/resources etc. defined in application
context file "context.xml" from Spring "applicationContext.xml" file?
I've only found how you can point to properties file or environment
parameters.
Let's say I've "META-INF/context.xml":
<Context path="/example" reloadable="false">
<Parameter name="exampleParam"
value="123456" override="false" />
</Context>
and in "WEB-INF/applicationContext.xml":
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="ExampleBean" class="com.example.ExampleBean">
<property name="exampleValue">
<value>
<!--
WHAT I ENTER HERE TO GET "exampleParam" VALUE
FROM CONTEXT.XML?!?
-->
</value>
</property>
</bean>
</beans>
so What I need to put in <value /> tag to get value from context.xml?
> How do you refer to parameters/resources etc. defined in application
> context file "context.xml" from Spring "applicationContext.xml" file?
Not sure if this solves your problem, because I haven't worked with
parameters and resources, but have you tried
> Let's say I've "META-INF/context.xml":
> <Context path="/example" reloadable="false">
> <Parameter name="exampleParam"
> value="123456" override="false" />
> </Context>
> <beans>
<!-- This doesn't strike me as appetizing, but might work -->
<import resource="../META-INF/context.xml"/>
> <bean id="ExampleBean" class="com.example.ExampleBean">
? This should make the definitions in context.xml visible (with no
further qualification) in applicationContext.xml.

Signature
C. Benson Manica | I appreciate all corrections, polite or otherwise.
cbmanica(at)gmail.com |
----------------------| I do not currently read any posts posted through
sdf.lonestar.org | Google groups, due to rampant unchecked spam.
Jani Tiainen - 27 Aug 2007 05:48 GMT
Christopher Benson-Manica kirjoitti:
>> How do you refer to parameters/resources etc. defined in application
>> context file "context.xml" from Spring "applicationContext.xml" file?
[quoted text clipped - 16 lines]
> ? This should make the definitions in context.xml visible (with no
> further qualification) in applicationContext.xml.
I've feeling that there is much simpler solution since as I understood
context.xml should be already populated in application before spring
kicks off. Therefore I suspect that there is (simple) way to retrieve
values from already populated context.
I just need to find out how. Importing resource that is already part of
application sounds very bad hack.

Signature
Jani Tiainen
Jani Tiainen - 27 Aug 2007 08:24 GMT
Jani Tiainen kirjoitti:
> Christopher Benson-Manica kirjoitti:
>>
[quoted text clipped - 26 lines]
> I just need to find out how. Importing resource that is already part of
> application sounds very bad hack.
Well, replying to myself, correct way to do is:
<bean id="propertyConfigurer"
class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"
/>
More info can be found from that class documentation.

Signature
Jani Tiainen