Spring Social Facebook dependency issue

1.6k views Asked by At

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

2

There are 2 answers

2
Keerthivasan On BEST ANSWER

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

0
LynAs On

I found another way to fix this problem.

Clone the repo that site tell you to clone. Import the project as existing maven project. Then go to the .m2 folder and get all the jar file needed for this project