Spring Framework 4.0 and Java Generics
With the recent RC2 release of Spring Framework 4.0; and GA due before the year's end, here is a little teaser of some of the changes that should improve your life if you work with Java generic types.
Spring has had pretty good Java generics support for a while. For example, with version 3.2 you can easily inject all beans of a specific type into a generic List
just by using the @Autowired
annotation:
@Autowired
private List<MyType> beans;
// all beans that extends MyType will be injected
Spring's conversion service, binding system and Web MVC framework are all 'generic aware' and there are also the handy GenericCollectionTypeResolver
and GenericTypeResolver
…