Bean of type ConnectionFactoryLocator couldn't be found

55 views Asked by At

I want to add into my web application a login system from facebook. I used this tutorial. When I run the github project from tutorial all is working but when I try implement it myslef I got this error message:

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.

This is my config class:

@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

There are 0 answers