0

I am following the tutorial to implement a twitter search on Spring framework. Unfortunately, I get an type mismatch error in here:

import org.springframework.social.twitter.api.impl.TwitterTemplate;
import twitter4j.Twitter;
 ...
Twitter twitter = new TwitterTemplate();

Type mismatch: cannot convert from TwitterTemplate to Twitter

Why am I getting this error? Should I just simply add a casting here?

mahsa.teimourikia
  • 1,664
  • 9
  • 32
  • 64

1 Answers1

2

You have imported the wrong Twitter class.

use

import org.springframework.social.twitter.api.Twitter

instead.

@see Java Doc: Twiter Template

Ralph
  • 118,862
  • 56
  • 287
  • 383