This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

What this means is to actually return something that can make it through compilation you have to have a instantiated object ahead of time to call getClass on. This is not the most ideal situation as per the javadoc "In the case of implementations that are creating a singleton object, this method should try to avoid singleton creation as far as possible; it should rather estimate the type in advance."

There is of course a work around (which is why I put this as minor) you can either not use FactoryBean generics or be sure to not peg a internal generic ex: FactoryBean<List>. I understand that changing such a important interface at this point is unrealistic but I would ask if the implementation is left as is, a note be added to the javadoc about how to work around this particular wart in the java generics implementation.

This is quite a tricky one, and it's a shame it wasn't addressed during the milestone builds, when the issue was first raised.