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

Spring3.2 bug context:property-placeholder nested search property appear java.lang.StackOverflowError [SPR-10549] #15180

Closed
spring-issuemaster opened this issue May 10, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented May 10, 2013

zhangkaitao opened SPR-10549 and commented

<context:property-placeholder location="classpath:resources.properties" ignore-unresolvable="true"/>  
  1. resources.properties
abc=${dce} 
dce=${none}

3

@Value("${abc}")  
private String abc; 
  1. appear
java.lang.StackOverflowError
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.naming.internal.VersionHelper12.getJndiProperties(VersionHelper12.java:106)
	at com.sun.naming.internal.ResourceManager.getInitialEnvironment(ResourceManager.java:202)
	at javax.naming.InitialContext.init(InitialContext.java:238)
	at javax.naming.InitialContext.<init>(InitialContext.java:216)
	at org.springframework.jndi.JndiTemplate.createInitialContext(JndiTemplate.java:136)
	at org.springframework.jndi.JndiTemplate.getContext(JndiTemplate.java:103)
	at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
	at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
	at org.springframework.jndi.JndiLocatorDelegate.lookup(JndiLocatorDelegate.java:38)
	at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:77)
	at org.springframework.jndi.JndiLocatorDelegate.lookup(JndiLocatorDelegate.java:33)
	at org.springframework.jndi.JndiPropertySource.getProperty(JndiPropertySource.java:82)
	at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:73)
	at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:59)
	at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:427)
	at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$1.getProperty(PropertySourcesPlaceholderConfigurer.java:131)
	at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$1.getProperty(PropertySourcesPlaceholderConfigurer.java:128)
	at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:73)
	at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:59)
	at org.springframework.core.env.AbstractPropertyResolver$1.resolvePlaceholder(AbstractPropertyResolver.java:176)
	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:146)
	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:125)

why:
please see http://jinnianshilongnian.iteye.com/blog/1866892


Affects: 3.2.2

Reference URL: http://jinnianshilongnian.iteye.com/blog/1866880

Issue Links:

  • #14203 Allow PropertyResolver implementations to ignore unresolvable ${placeholders}
@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 26, 2013

Phil Webb commented

I have not been able to reproduce the StackOverflowError, however, there does appear to be a problem resolving nested resources using the new Environment abstraction. Setting ctx.getEnvironment().setIgnoreUnresolvableNestedPlaceholders(true) appears to have no effect.

For your immediate problem could you let me know if setting system-properties-mode="NEVER" provides a suitable workaround.

If you are able to edit this project to better reproduce the issue that would be very useful.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 31, 2013

Juergen Hoeller commented

The problem is that a PropertySource getProperty call attempts nested placeholder resolution itself... whereas our PropertySourcesPlaceholderConfigurer needs to remain in control of that, operating on the raw property values instead of pre-resolved ones.

Fixed for 4.0 RC1 and 3.2.4 now.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.