Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

${...} placeholders support for import [SPR-1332] #6032

Closed
spring-projects-issues opened this issue Sep 28, 2005 · 4 comments
Closed

${...} placeholders support for import [SPR-1332] #6032

spring-projects-issues opened this issue Sep 28, 2005 · 4 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Cameron Taggart opened SPR-1332 and commented

Please add ${...} placeholders support for <import resource="${...}"/>. That would enable us to do something like:
<import resource="file:${catalina.base}/conf/app-conf/messaging.xml"/>

I started a forum topic about this yesterday, but this is probably a better spot for the feature request.
http://forum.springframework.org/viewtopic.php?t=9193

I imagine this request is similar to the changes you made for Log4J in Spring 1.2.5, Log4jConfigurer resolves ${...} placeholders in Log4J config locations as system properties.

My goal is to allow configuration of webapps from outside the war. Today, we can do that using properties files, but I don't know of any way to do that xml files. Any suggestions? Here are some snippets to explain:

<import resource="file:${catalina.base}/conf/app-conf/messaging.xml"/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>WEB-INF/messaging.default.properties</value>
<value>file:${catalina.base}/conf/app-conf/messaging.properties</value>
</list>
</property>
</bean>
Thanks,
Cameron


No further details from SPR-1332

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Thanks for the suggestion! I've added such support for system property placeholders for import location, similar to the placeholder support for Log4J config locations.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Joe Shomphe commented

This only seems to work with enviornment variables, not with variables pulled from a property file:

IE, if I run my test with -Dprop.name=FOO

<import resource="${property.name}Context.xml"/> will load

if I do the following without the -Dprop.name flag:

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" autowire="no">
	<property name="locations">
		<list>	
  			<value>file:${user.home}/test.properties</value>
		</list>
	</property>
	<property name="ignoreResourceNotFound">
		<value>true</value>
	</property>		
</bean>

and have a prop.name entry in test.properties

this no longer works

@spring-projects-issues
Copy link
Collaborator Author

Cameron Taggart commented

Joe, that is correct. I've requested and Juergen has added support for system properties, not those from properties files.

@spring-projects-issues
Copy link
Collaborator Author

Cameron Taggart commented

Spring version 1.2.6 still isn't out yet. :( I'm really looking forward to this bug fix.

Thanks,
Cameron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants