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

Spring ConversionService does not work with SpEL [SPR-6563] #11229

Closed
spring-projects-issues opened this issue Dec 14, 2009 · 2 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Liu, Yinwei David opened SPR-6563 and commented

We encounter two issues when we configured conversionService in Spring config file. Please see attached test case:
Java:
public class TestBean{
private List<String> addresses;
...
}

Config:
<bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean" />

<bean class="TestBean">
<property name="addresses">
<list>
<value>#{'test-' + strValue + '-end'}</value>
<value>#{'test-' + strValue}</value>
<value>#{'test-' + numValue+ '-end'}</value>
<value>#{'test-' + numValue}</value>
</list>
</property>
</bean>
<bean id="numValue" class="java.lang.Integer" >
<constructor-arg value="111"/>
</bean>
<bean id="strValue" class="java.lang.String" >
<constructor-arg value="222"/>
</bean>


Affects: 3.0 RC3

Referenced from: commits 1c33206

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

This doesn't seem to be related to SpEL specifically. It's rather a problem with constructor resolution for that bean of type String: We need to catch ConversionException and ConvertedNotFoundException in BeanWrapper's convertIfNecessary there. Otherwise the String(byte[]) constructor isn't detected as an inappropriate choice and will be processed like it was a matching constructor... leading to an exception that disrupts bean creation completely.

Fixed for 3.0 GA. This will make the next snapshot (508); feel free to give it a try!

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Liu, Yinwei David commented

Thanks Juergen.
It resolved the issue.

david

@spring-projects-issues spring-projects-issues added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.0 GA milestone Jan 11, 2019
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: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants