【发布时间】:2018-11-20 06:13:12
【问题描述】:
我在我的 Spring Boot 应用程序中使用 maven。我想登录 Facebook,所以我按照官方 Spring 教程(https://spring.io/guides/gs/accessing-facebook/)进行操作。我认为以下依赖存在问题:
@Controller
public class FacebookController
{
private Facebook facebook;
private ConnectionRepository connectionRepository;
public FacebookController(Facebook facebook, ConnectionRepository connectionRepository) {
this.facebook = facebook;
this.connectionRepository = connectionRepository;
}
@GetMapping
public String helloFacebook(Model model) {
if (connectionRepository.findPrimaryConnection(Facebook.class) == null) {
return "redirect:/connect/facebook";
}
model.addAttribute("facebookProfile", facebook.userOperations().getUserProfile());
PagedList<Post> feed = facebook.feedOperations().getFeed();
model.addAttribute("feed", feed);
return "hello";
}
}
我正在使用这个依赖项
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-facebook</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
但我也尝试过版本 1.1.1 RELEASE。
我研究过类似的问题,但它们对我不起作用(Maven cannot find spring social)。
【问题讨论】:
标签: maven spring-boot facebook-graph-api