PDA

View Full Version : Direct Support for Google Guava APIs?



RGFanta
Nov 22nd, 2010, 02:37 PM
Hi,

Is there any direct support planned for the use of Google Guava APIs? Being able to use Google Collections for application configuration might be a good help.
Link: http://code.google.com/p/guava-libraries/
How-to-use: http://codemunchies.com/2009/10/beautiful-code-with-google-collections-guava-and-static-imports-part-1/

Someone has already tried to create a lib to help integrate Spring with Google Collections here:
http://code.google.com/p/spring-collections/

However, it looks like that lib hasn't been updated in a year and may need some help to make it production ready.

Many thanks,
Rick

guznik
Nov 23rd, 2010, 06:44 AM
Hi,

Nothing prevents you from using any such library in Spring java configuration (@Configuration annotated classes), in bean lifecycle methods or anywhere else in your code.

Direct support in XML does not seem very valuable to me because it wouldn't make your code more readable nor will it make it more type-safe, which are two main benefits of using Google Collections and Guava.

I think XML configuration is beneficial only when it actually reduces the amount of code and the possibility of mistakes such as in <context:component-scan/> and <tx:annotation-driven/>