Java 实现spring社交facebook时出错
我试图在我的项目中实现SpringSocialFacebook,但它不起作用。 我遵循了这个教程 我得到我的应用程序id和密码 我的控制器:Java 实现spring社交facebook时出错,java,facebook,spring-social,Java,Facebook,Spring Social,我试图在我的项目中实现SpringSocialFacebook,但它不起作用。 我遵循了这个教程 我得到我的应用程序id和密码 我的控制器: @Controller @RequestMapping("/") public class LoginController { @Autowired IUserService userService = null; private Facebook facebook; @Inject public LoginController(Facebook
@Controller
@RequestMapping("/")
public class LoginController {
@Autowired
IUserService userService = null;
private Facebook facebook;
@Inject
public LoginController(Facebook facebook) {
this.facebook = facebook;
}
@RequestMapping(method = RequestMethod.GET)
public String display(Model model) {
Quote quote = userService.getTest();
System.out.println("type = " + quote.getType());
System.out.println("id of the code is " + quote.getValue().getId());
System.out.println("the quote = " + quote.getValue().getQuote());
if (!facebook.isAuthorized()) {
return "redirect:/connect/facebook";
}
model.addAttribute(facebook.userOperations().getUserProfile());
PagedList<Post> homeFeed = facebook.feedOperations().getHomeFeed();
model.addAttribute("feed", homeFeed);
return WebConstant.HOME_VIEW;
}
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String loginPage() {
return WebConstant.LOGIN_VIEW;
}
}
servlet-dispatcher.xml:
<beans>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles-def.xml</value>
</list>
</property>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/>
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages"/>
</bean>
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
<mvc:annotation-driven></mvc:annotation-driven>
有人有解决方案吗?你能分享你的spring配置吗?@px5x2我添加了application.java和我的servlet disaptcher请检查:
<beans>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles-def.xml</value>
</list>
</property>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/>
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages"/>
</bean>
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
<mvc:annotation-driven></mvc:annotation-driven>
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}