Search code examples
facebookspringjakarta-eespring-socialspring-social-facebook

Spring Social Facebook dependency issue


I am trying to connect my application with facebook. I copied the code from

http://spring.io/guides/gs/accessing-facebook/

Added all the stated dependencies but the error doesn't seem to go. Code given below screenshot attached. Can anyone suggest what might be the issue.

The error is @EnableInMemoryConnectionRepository cannot be resolved. UserIdSource cannot be resolved.

package controllers;

import org.springframework.context.annotation.Bean;
import org.springframework.social.connect.ConnectionFactoryLocator;
import org.springframework.social.connect.ConnectionRepository;
import org.springframework.social.connect.web.ConnectController;
import org.springframework.social.facebook.config.annotation.EnableFacebook;

@EnableFacebook(appId="someAppId", appSecret="shhhhhh!!!")
@EnableInMemoryConnectionRepository
public class FacebookConfig {

    @Bean
    public ConnectController connectController(ConnectionFactoryLocator connectionFactoryLocator, ConnectionRepository connectionRepository) {
        return new ConnectController(connectionFactoryLocator, connectionRepository);
    }

    @Bean
    public UserIdSource userIdSource() {
        return new UserIdSource() {
            @Override
            public String getUserId() {
                return "testuser";
            }
        };
    }

}

enter image description here


Solution

  • Try adding spring-social-config .jar file to your lib. This link will help you to download. Use spring-social-core-1.1.0.M4.jar instead of spring-social-core-1.0.0.Release.jar. Here, you can download from here