Taking a quick look at开发者_如何转开发 SpringSocial it would appear that each social network has its own different unique. There is no interface exposing a universal
- authenticate to network
- sendMessage
The reason for the "authenticate to network" listed above is i would like to include the facility for the application itself to publish messages rather than just individual users.
At least Jtwitter exposes a simple api to authenticate and then send a tweet. To achieve the same w/ SS the amount of complexity is overwhelming compared to the relative simplicity of Jtwitter. SS requires Spring, commons http client which obviously is a lot more than jtwitter. If SS had a universal mechanism to connect and then send rather than custom code for each then it would be probably worthwhile, but in the end it doesnt...
Are my assumptions or perceptions about SS wrong ?
Spring Social is composed behind the scene in four parts :
- An OAuth API to handle 3-legged OAuth dance (most valuable feature IHMO)
- A persistence layer to maintain user's accounts informations (OAuth secret, profileUrl, imageUrl, ...)
- Signing in with Service Provider Accounts (eg. FacebookConnect)
- Java binding to the provider's API, mostly based on RestTemplate
Only the last part can be compared to wrapper libs (eg. JTwitter). If you don't need to establish OAuth connections, don't use Spring Social.
My 2 cents thought about SS :
I was a bit disappointed, at first glance. Spring Social is described as an extension of the Spring Framework that allows you to connect your applications with Software-as-a-Service (SaaS) providers such as Facebook and Twitter. Unfortunately this framework in v1.0 cannot be easily extended to support connections without OAuth.
It should be better if SS have been split in 3 parts, for example :
- spring-oauth
- spring-mvc-signin
- spring-social (only providers binding)
Spring Social mainly focuses on simplifying the OAuth-related issues, when using those social APIs.
It's aim is NOT to provide a unified API to similar functions across different social networking sites - as such, it has a specialized API for each site.
Which does not mean that you could not build an additional API layer on top of Spring Social that would unify some (important for you) aspect of the API.
You complained about the complexity of the Spring Social API - I don't get it, could you tell exactly, what is complicated about posting a tweet with Spring Social:
twitter.updateStatus("Hey, I'm tweeting with #Spring Social!");
(this is from the SpringSource blog post)
And, about the dependencies: most of the applications that would use Spring Social most probably already have Spring and HttpClient as dependencies, so these are not anything extra for the typical Spring Social developer.
Finally, if jTwitter satisfies your needs then that seems to be the best fit for you. To each, their own. ;-)
See also:
- Socializing Spring Applications - SpringSource blog
- How Spring is Simplifying Social Network Interactions - discussion on TheServerSide
精彩评论