나는 나와 함께 부담 때문에 봄에 새로 온 사람 :봄에 Google Oauth를 만드는 방법은 무엇입니까?
O를 나는 내 웹 사이트에 작동하는 구글의 Oauth 연결을 얻으려고 봄 부팅 v1.1.8.RELEASE
을 사용하고 있습니다.
트위터 & facebook이 작동하는 동안 나는 spring-social-google을 작동 시키려고 노력하고 있습니다.
나는 이것을 읽었다 http://gabiaxel.github.io/spring-social-google-reference/overview.html 나는 다른 공급자 (twitter & 페이스 북)를 위해 Spring.io에서 튜토리얼을 읽었다. 내 템플릿 googleConnect.html과 googleConnected.html의 페이스 북에 같은 파일이
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
@RequestMapping("/google")
public class GoogleController {
private Google google;
@Inject
public GoogleController(Google google) {
this.google = google;
}
/**
*
* @param model
* @return
*/
@RequestMapping(method = RequestMethod.GET)
public String helloGoogle(Model model) {
if (!google.isAuthorized()) {
return "redirect:/connect/google";
}
model.addAttribute(google.plusOperations().getGoogleProfile());
return "testGoogle";
}
}
: 그래서 여기
는 내가 가지고있는 코드입니다.메이븐은 구글 응용 프로그램에서 제대로
application.properties 비밀과 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: {}
빈은 다른 공급자와 마찬가지로 자동으로 작성되어야합니까?
감사합니다.
편집 :이 콩이 작동하지만 난 내 컨트롤러에서 구현하는 방법을 모르는
?
@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;
}
}
안녕하세요, 답변 주셔서 감사하지만 같은 오류가 발생했습니다. 2014-11-16 10 : 48 : 29.578 오류 428 --- [주] osboot.SpringApplication : 응용 프로그램 시작 실패 org.springframework.beans. factory.UnsatisfiedDependencyException : 이름이 'googleController'인 ... – hyptos