← Back to team overview

dhis2-devs-core team mailing list archive

Upgrade to Spring 4

 

Hi guys

I have just upgraded to Spring 4 (.0.6) and for the most part this was
painless. There is however one particular issue you need to be aware of.

When you are doing any kind of @Autowired for collection, you will need to
properly specify the generic type, i.e. if you have an base class A and
sub-classes B and C (as spring-components), you will now need to specify
that you want a sub-class of A

This was like this in the old Spring 3.x:
@Autowired
private List<A> listA = ...

But now, you will have to do this:
@Autowired
private List<? extends A> listAImpl = ...

I have fixed this where I saw it, but if there are any issues, please
report back to me (or try and fix it, it's a very simple fix)

Here are some articles about the new generic support:
http://spring.io/blog/2013/12/03/spring-framework-4-0-and-java-generics
http://www.intertech.com/Blog/spring-4-generic-qualifiers/
http://www.jayway.com/2013/11/03/spring-and-autowiring-of-generic-types/

--
Morten