Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法解析EnableTwitter和EnableFacebook_Java_Facebook_Spring_Api_Twitter - Fatal编程技术网

Java 无法解析EnableTwitter和EnableFacebook

Java 无法解析EnableTwitter和EnableFacebook,java,facebook,spring,api,twitter,Java,Facebook,Spring,Api,Twitter,我正在尝试将我目前的spring项目与Twitter和Facebook连接起来,为此,我遵循以下两篇文章的说明: 因此,我将这两个类添加到我的项目中: TwitterConfig.java import org.springframework.context.annotation.Bean; import org.springframework.social.UserIdSource; import org.springframework.social.connect.Connectio

我正在尝试将我目前的spring项目与Twitter和Facebook连接起来,为此,我遵循以下两篇文章的说明:

因此,我将这两个类添加到我的项目中:

TwitterConfig.java

import org.springframework.context.annotation.Bean;
import org.springframework.social.UserIdSource;
import org.springframework.social.connect.ConnectionFactoryLocator;
import org.springframework.social.connect.ConnectionRepository;
import org.springframework.social.connect.web.ConnectController;
import org.springframework.social.twitter.config.annotation.EnableTwitter;
import org.springframework.social.config.annotation.EnableInMemoryConnectionRepository;

@EnableTwitter(appId="...", appSecret="...")
@EnableInMemoryConnectionRepository
public class TwitterConfig {

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

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

}
import org.springframework.context.annotation.Bean;
import org.springframework.social.UserIdSource;
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;
import org.springframework.social.config.annotation.EnableInMemoryConnectionRepository;

@EnableFacebook(appId="...", appSecret="...")
@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";
            }
        };
    }

}
FacebookConfig.java

import org.springframework.context.annotation.Bean;
import org.springframework.social.UserIdSource;
import org.springframework.social.connect.ConnectionFactoryLocator;
import org.springframework.social.connect.ConnectionRepository;
import org.springframework.social.connect.web.ConnectController;
import org.springframework.social.twitter.config.annotation.EnableTwitter;
import org.springframework.social.config.annotation.EnableInMemoryConnectionRepository;

@EnableTwitter(appId="...", appSecret="...")
@EnableInMemoryConnectionRepository
public class TwitterConfig {

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

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

}
import org.springframework.context.annotation.Bean;
import org.springframework.social.UserIdSource;
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;
import org.springframework.social.config.annotation.EnableInMemoryConnectionRepository;

@EnableFacebook(appId="...", appSecret="...")
@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";
            }
        };
    }

}
并在my pom.xml中添加以下行:

<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-facebook</artifactId>
    <version>1.1.0.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-twitter</artifactId>
    <version>1.1.0.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-core</artifactId>
    <version>1.1.0.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-config</artifactId>
    <version>1.1.0.RELEASE</version>
</dependency>

org.springframework.social
春季社交facebook
1.1.0.1发布
org.springframework.social
春季社交推特
1.1.0.1发布
org.springframework.social
春季社会核心
1.1.0.1发布
org.springframework.social
spring社交配置
1.1.0.1发布
但尽管如此,Twitter、Facebook和MemoryConnectionRepository的注解仍然无法解决


任何人都可以说这里出了什么问题?

@EnableTwitter
和类似的功能不再存在

通用的
@EnableSocial
现在已经存在。而
SocialConfigurer
则由您来实施

对,那些行会应该更新,它在我们的雷达上

更多信息可从

谢谢你再次指出