最後の 2 つのツイートだけが必要なのに、なぜ認証が必要なのですか? 接続は必要ないので、最小限の構成を作成したいと思います。Twitter api を理解しているので、つぶやきを取得するためだけに consumerKey/consumerSecret を用意する必要はありません。
豆:
<bean id="twitter" class="org.springframework.social.twitter.api.impl.TwitterTemplate" />
スプリング コントローラー:
@Controller
public class FragmentController {
@Autowired
private Twitter twitter;
@ModelAttribute
public void global(ModelMap map) {
map.addAttribute("tweets", twitter.timelineOperations().getUserTimeline("myTwitterUsername", 2));
}
@RequestMapping("index.html")
public String index() {
return "index";
}
}