Skip to content

Instantly share code, notes, and snippets.

@cbeams
Created April 30, 2014 09:19
Show Gist options
  • Save cbeams/a2a51cd1ed2ddc2a6677 to your computer and use it in GitHub Desktop.
Save cbeams/a2a51cd1ed2ddc2a6677 to your computer and use it in GitHub Desktop.
[4/30/14, 11:12:59 AM] Chris Beams: Hey, did you see this? https://twitter.com/david_welch/status/461190856364404737
[4/30/14, 11:13:48 AM] Chris Beams: Not sure if the ability to specify generic types made its way in (in a way that can be used from within a BDRPP) with the changes for generic collection autowiring...
[4/30/14, 11:14:23 AM] Juergen Hoeller: hmm, that hasn't been made possible... with any of our bean definition styles
[4/30/14, 11:14:41 AM] Chris Beams: yeah, I took a look through the hierarchy and didn't see anything to that effect.
[4/30/14, 11:14:49 AM] Juergen Hoeller: we only match against actually declared generic types in the target bean class or the target factory method's return type
[4/30/14, 11:15:02 AM] Juergen Hoeller: so in that sense, I suppose it is possible with @Bean methods
[4/30/14, 11:15:26 AM] Juergen Hoeller: but only to the extent as it is possible with any kind of factory method
[4/30/14, 11:15:29 AM] Chris Beams: yeah.
[4/30/14, 11:15:54 AM] Juergen Hoeller: in principle, he could register a GenericBeanDefinition that points to a factory method with a fully declared generic return type
[4/30/14, 11:15:55 AM] Chris Beams: He could create an intermediate (faux-reification) type..
[4/30/14, 11:16:13 AM] Chris Beams: hm... that's interesting.
[4/30/14, 11:16:23 AM] Chris Beams: wonder if it would work for his use case.
[4/30/14, 11:16:30 AM] Juergen Hoeller: or yeah, the recommended option would be to simply register a subclass that properly substitutes the type variables
[4/30/14, 11:16:54 AM] Chris Beams: okay.. I'll respond with the above.
[4/30/14, 11:17:13 AM] Chris Beams: ... and share with you any bottle he buys us :)
[4/30/14, 11:17:59 AM] Juergen Hoeller: ha, thanks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment