So Im attempting to use Account
to retrieve A facebooks user name but everytime I run it it throws a lot of errors and my application wont even start. Most of the errors are resulting from Caused by: org.springframework.beans.factory.NoSuchBeanDefini tionException: No qualifying bean of type [org.springframework.social.facebook.api.Account] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
heres the code im using.
to retrieve A facebooks user name but everytime I run it it throws a lot of errors and my application wont even start. Most of the errors are resulting from Caused by: org.springframework.beans.factory.NoSuchBeanDefini tionException: No qualifying bean of type [org.springframework.social.facebook.api.Account] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
heres the code im using.
Code:
import java.util.List;
import javax.inject.Inject;
import org.springframework.social.facebook.api.Facebook;
import org.springframework.social.facebook.api.PagedList;
import org.springframework.social.facebook.api.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.social.facebook.api.Account;
/**
* Simple little @Controller that invokes Facebook and renders the result.
* The injected {@link Facebook} reference is configured with the required authorization credentials for the current user behind the scenes.
* @author Keith Donald
*/
@Controller
public class HomeController {
private final Facebook facebook;
private final Account account;
@Inject
public HomeController(Facebook facebook, Account account) {
this.facebook = facebook;
this.account = account;
}
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Model model) {
List<Reference> friends = facebook.friendOperations().getFriends();
String ID = account.getName();
model.addAttribute("friends", friends);
DataBase database = new DataBase();
database.createDb(friends);
database.removeData();
database.shutDown();
return "home";
}
}