Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

还是第五章的问题 #5

Open
xiaodaoM opened this issue Dec 24, 2017 · 2 comments
Open

还是第五章的问题 #5

xiaodaoM opened this issue Dec 24, 2017 · 2 comments

Comments

@xiaodaoM
Copy link

image
我下载源码 然后dubug 还是qubudao取不到值 .qq注册之后 就无法获取token 一直报错
image
我下载的分支 5-6 和5-7 都有这样的问题...还请大神解惑..不然下面的视频看不下去.

@longfeizheng
Copy link

把写在SocialConfig类中的getUsersConnectionRepository方法放置到QQAuthConfig中即可。( @OverRide

@phoenix6111
Copy link

phoenix6111 commented Apr 17, 2018

查看org.springframework.social.config.annotation.SocialConfiguration.usersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) 源码就知道原因了,
for (SocialConfigurer socialConfigurer : socialConfigurers) { UsersConnectionRepository ucrCandidate = socialConfigurer.getUsersConnectionRepository(connectionFactoryLocator); if (ucrCandidate != null) { usersConnectionRepository = ucrCandidate; break; } }
它只要第一个SocialConfigurer的实现类中获取到的UsersConnectionRepository不为空就直接break了,然后,我们SocialConfig类继承的SocialConfigurerAdapter类默认实现了getUsersConnectionRepository()方法,返回的是InMemoryUsersConnectionRepository对象。所以我们需要让SocialConfig类在SocialConfigurer的所有实现类中第一个被创建,我的方法是添加@Order注册即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants