Posting a tweet to Twitter

In this recipe, you'll learn how to post a tweet on behalf of a user from a Spring web application.

Getting ready

This recipe uses the code from the Connecting to Twitter recipe.

How to do it…

In the TwitterController class, in the tw() method, use the Twitter object to post a tweet.

twitter.timelineOperations().updateStatus("Just a test");

Get Spring Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.