找不到ConnectionFactoryLocator类型的Bean

时间:2019-09-04 14:06:42

标签: spring-social

我想将来自Facebook的登录系统添加到我的Web应用程序中。 我使用了这个tutorial。当我从教程中运行github项目时,所有项目都在工作,但是当我尝试实现它时,我收到了以下错误消息:

Field connectionFactoryLocator in pl.rzesyozimek.app.configutarion.SecurityConfig required a bean of type 'org.springframework.social.connect.ConnectionFactoryLocator' that could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'org.springframework.social.connect.ConnectionFactoryLocator' in your configuration.

这是我的配置类:

@Configuration
@EnableWebSecurity
@ComponentScan(basePackages = { "pl.rzesyozimek.app.security" })
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private UserDetailsService userDetailsService;

    @Autowired
    private ConnectionFactoryLocator connectionFactoryLocator;

    @Autowired
    private UsersConnectionRepository usersConnectionRepository;

    @Autowired
    private FacebookConnectionSignup facebookConnectionSignup;

    @Override
    protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
        auth.userDetailsService(userDetailsService);
    }

    @Override
    protected void configure(final HttpSecurity httpSecurity) throws Exception{
        httpSecurity
                .csrf().disable()
                .authorizeRequests()
                .antMatchers("/login*","/signin/","/signup/","console/**").permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin().loginPage("/login").permitAll()
                .and()
                .logout();
    }

    @Bean
    public ProviderSignInController providerSignInController() {
        ((InMemoryUsersConnectionRepository) usersConnectionRepository).setConnectionSignUp(facebookConnectionSignup);
        return new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, new FacebookSignInAdapter());
    }
}

0 个答案:

没有答案