Spring 如何在春季创建GoogleOAuth?

Spring 如何在春季创建GoogleOAuth?,spring,google-oauth,spring-boot,Spring,Google Oauth,Spring Boot,我是春天的新手,所以请容忍我:哦 我使用的是SpringBootV1.1.8.0版本 我正在尝试与我的网站建立一个谷歌Oauth连接 因此,我正试图让spring社交谷歌在twitter和facebook的同时运行 我读了这个 我阅读了Spring.io为其他提供商(twitter和Facebook)提供的教程 下面是我的代码: 我的模板中有类似facebook的文件 googleConnect.html和一个googleConnected.html Maven正在正确导入依赖项 appli

我是春天的新手,所以请容忍我:哦

我使用的是SpringBootV1.1.8.0版本

我正在尝试与我的网站建立一个谷歌Oauth连接

因此,我正试图让spring社交谷歌在twitter和facebook的同时运行

我读了这个 我阅读了Spring.io为其他提供商(twitter和Facebook)提供的教程

下面是我的代码:

  • 我的模板中有类似facebook的文件 googleConnect.html和一个googleConnected.html

  • Maven正在正确导入依赖项

  • application.properties具有来自google的机密和appid 我创建的应用程序

以下是我的错误:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name    'googleController' defined in file [C:\Users\Antoine\Documents\NetBeansProjects\p0907931-cinemagik\app\target\classes\app\controllers\GoogleController.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.social.google.api.Google]: : No qualifying bean of type [org.springframework.social.google.api.Google] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.social.google.api.Google] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
bean应该像其他提供者一样自动连接,对吗

谢谢你抽出时间

编辑:

这个bean正在工作,但我不知道如何在我的控制器中实现它

@Configuration
public class SocialConfig {

    @Inject
    private Environment environment;

    @Bean
    public ConnectionFactoryLocator connectionFactoryLocator() {
        ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
        registry.addConnectionFactory(new GoogleConnectionFactory(
            environment.getProperty("superAPI"),
            environment.getProperty("superSecret")));

        return registry;
    }

}

SpringBoot只支持通过Twitter、Facebook和LinkedIn(而不是Google)自动配置SpringSocial。您可能可以从现有的实现中复制代码并进行修改:。

您好,谢谢您的回答,但我得到了相同的错误:2014-11-16 10:48:29.578错误428---[main]o.s.boot.SpringApplication:应用程序启动失败org.springframework.beans.factory.UnsatisfiedDependencyException:创建名为“googleController”的bean时出错…,您好,您知道为什么google没有?有人知道我们在哪里可以得到谷歌的实现吗?非常感谢。
@Configuration
public class SocialConfig {

    @Inject
    private Environment environment;

    @Bean
    public ConnectionFactoryLocator connectionFactoryLocator() {
        ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
        registry.addConnectionFactory(new GoogleConnectionFactory(
            environment.getProperty("superAPI"),
            environment.getProperty("superSecret")));

        return registry;
    }

}
package app.controllers;

import javax.inject.Inject;

import org.springframework.social.google.api.Google;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class GoogleController {

    private Google google;

    @Inject
    public GoogleController(Google google) {
        this.google = google;
    }

    /**
     *
     * @param model
     * @return
     */
    @RequestMapping(method = RequestMethod.GET,value="/google")
    public String helloGoogle(Model model) {
        if (!google.isAuthorized()) {
            return "redirect:/connect/google";
        }

        model.addAttribute(google.plusOperations().getGoogleProfile());
        return "testGoogle";
    }

}