java - Spring Social /connect/twitter Request method 'GET' not supported -
i'm following http://spring.io/guides/gs/accessing-twitter/ setup spring social twitter spring boot when run application , redirected localhost:8080/connect/twitter i'm getting:
there unexpected error (type=method not allowed, status=405). request method 'get' not supported
i know have with mapping of connectcontroller how 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); } }
there no view resolver in code views (returned strings) cannot rendered.
you have add view resolver (e.g. thymeleaf, freemarker, jsp) or put line in application.properties
spring.social.auto_connection_views=true
this render views using default templates.
Comments
Post a Comment