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

util:map does not recognize the attribute of value-type [SPR-10994] #15622

Closed
spring-projects-issues opened this issue Oct 16, 2013 · 2 comments
Closed
Assignees
Labels
in: core type: bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Oct 16, 2013

Ronnin Lee opened SPR-10994 and commented

the util:map bean defined as follows will fail to initialize, an error "Type must not be null" occurs.

<util:map map-class="org.springframework.util.LinkedCaseInsensitiveMap"
          key-type="java.lang.String"
          value-type="org.springframework.web.servlet.ViewResolver">
</util:map>

as to org.springframework.beans.factory.config.MapFactoryBean, I find the fact:

when the attribute of map-class is set, MapFactoryBean will try to resolve the keyType and valueType of the map from ParameterizedType of map-class.

but the attribute of value-type is never used.


Affects: 3.2.4

Issue Links:

  • #14369 StackOverflowError when expression calls method which is a Collection of itself
@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 27, 2014

Juergen Hoeller commented

This seems to work fine in the 4.x line, with the above configuration parsed correctly. Note that key-type and value-type do not have to be parsed by MapFactoryBean; they are just used to parse the specified source entries within the util:map element (if any). On conversion from those source entries to the specified target map, we'll introspect the parameterized types declared on that target map class. This works as designed.

However, there is a chance this doesn't work correctly in the 3.2.x line. I'll backport the test and will resolve the issue accordingly then.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Nov 1, 2014

Juergen Hoeller commented

This did indeed fail against 3.2.x, and was easy enough to fix through a minor revision of our TypeDescriptor.valueOf implementation in that line.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: bug
Projects
None yet
Development

No branches or pull requests

2 participants