Ah...This is failing when you return the Model as a @ResponeBody-annotated controller method...not in Spring Social. I'll bet that if you were to call facebook.friendOperations().getFriendProfiles() and assign in to a List<Profile>, that line would work...but it would still fail when Spring Social attempts to convert a Model into a JSON object.
In short...Spring Social is working, but the problem is in your code.
What's going on here is that you're mixing two different approaches to Spring MVC. When working with human-facing Spring MVC applications (that is, those that take model data and bind them to a view...such as a JSP) then the Model class makes perfect sense. It also makes sense if you're relying on ContentNegotiatingViewResolver to convert that model to JSON for a REST API.
But when you annotate a handler method with @ResponseBody, there's a different thing going on. Technically, there is no model or view in that scenario, so populating the model is pointless. And attempting to convert it to a JSON object is...well...just weird. I can't say for sure what would happen there, but it appears that it just doesn't work. :-)
My guess is that you would want your handler method to look something like this instead:
Code:
@RequestMapping(value="/social/facebook/friends")
public @ResponseBody List<Profile> facebookFriends() {
return facebook.friendOperations().getFriendProfiles());
}
Or, if you want to return a JSON object with the list as a property:
Code:
@RequestMapping(value="/social/facebook/friends")
public @ResponseBody Map<String, ?> facebookFriends() {
Map<String, ?> response = new HashMap<String, ?>();
response.put("facebookProfiles", facebook.friendOperations().getFriendProfiles());
return response;
}
(Note that I just hacked these code snippets into the forum post and haven't actually tried them...so there could be errors in there.)
The point is that if you're using a @ResonseBody-annotated controller method, you just return the thing that you want converted to JSON...Spring takes care of it from there. There's no need for a Model.