I'm following http://spring.io/guides/gs/accessing-twitter/ to setup spring social for twitter with Spring boot but when I run the application and redirected to localhost:8080/connect/twitter I'm getting:
There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not supported
I know this have something to do with with the mapping of ConnectController how do I really fix this?
@Controller
public class HelloTwitterController {
private final Twitter twitter;
private final ConnectionRepository connectionRepo;
@Inject
public MessoTwitterController(Twitter twitter, ConnectionRepository connectionRepo) {
this.twitter = twitter;
this.connectionRepo = connectionRepo;
}
@RequestMapping(value ="/", method = RequestMethod.GET)
public String welcomeTwitter (Model model) {
if (connectionRepo.findPrimaryConnection(Twitter.class) == null)
return "redirect:/connect/twitter";
model.addAttribute(twitter.userOperations().getUserProfile());
model.addAttribute("friends", twitter.friendOperations().getFriends());
return "welcomeTwitter";
}
}
@SpringBootApplication
@EnableAutoConfiguration
@ComponentScan("com.mypackage")
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}