Senior Java developer, one of the top stackoverflow users, fluent with Java and Java technology stacks - Spring, JPA, JavaEE. Founder and creator of and . Worked on Ericsson projects, Bulgarian e-government projects and large scale recruitment platforms. Member of the jury of the International Olympiad in Linguistics and the Program committee of the North American Computational Linguistics Olympiad. Bozhidar is a DZone MVB and is not an employee of DZone and has posted 87 posts at DZone. You can read more from them at their website. View Full User Profile

Java Client for the Google+ API

  • submit to reddit

I decided that I can make a separate java client library for Google+ (since I was a bit unhappy with what Google have provided for Java developers: no maven dependency, not quite easy to use, not getting updated with the API latest additions, example project using jsp scriptlets).

The project is (not too creatively) called “google-plus-java-api” and can be found (including a “getting started” guide) on google code. I am already using it in production for some simple G+ features in my startup, and so I will be updating it whenever Google add more methods, or change something (which I hope won’t happen too often)

The project home page shows a sample code to get started. The It’s very similar to other REST API clients like twitter4j, linkedin4j, restfb, other spring social clients. The idea is to be simple and straightforward to use. It has a couple of dependencies, so here are few notes trying to justify them:

  • the library is based on spring-social. It provides a good OAuth2 support (although I had to make some customizations in order to support refresh tokens), and a RestTemplate to simplify rest invocations. The downside is that it fetches some more spring dependencies – spring-web, spring-core, spring-beans and spring-context. This may be problematic for android users, but in general spring-social runs fine on android
  • Jackson is used for JSON deserialization. I’ve seen benchmarks hinting that Jackson is the fastest out there, but either way it is widely adopted and working. It seems to also be working on android. In fact, you can use any json provider as long as you implement a message converter (there’s only a jackson converter built-in)
  • Apache http components are used for the underlying http communication. Again, industry standard. If you don’t want to use it, you can remove it from the classpath and the library will revert to a built-in simple handler.
  • joda-time is used to represent dates. While it may seem a bit aggressive to force joda-time, I consider it a plus – it introduces a library that every project must use anyway
  • slf4j – delegates to whatever logging framework your project is using. (There isn’t much logging happening at the moment though)

If using maven these dependencies will be fetched automatically. Currently only a snapshot is available from the sonatype repository.

The library is still in early development, but as I noted, it is and will be used by me in production, so I’ll be fixing issues quickly when they appear. Currently I’m low on automated tests, but that should improve as well. Any feedback or contributions are welcome.



Published at DZone with permission of Bozhidar Bozhanov, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)



Robert Craft replied on Thu, 2012/01/26 - 6:07am

I have been working on the Spring Social Google project: which so far abstracts access to Google+, Google Contacts and just started to work on Picasa. I would appreciate any feedback you may have on it and any insights you may have from comparing our work so far. I will also check out what you have done.

Spring Security

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.