使用spring social获得本网站的链接/connet时候报如下问题?

java.lang.IllegalAccessError: class org.springframework.social.connect.jdbc.JdbcConnectionRepository$$EnhancerBySpringCGLIB$$1196d00b cannot access its superclass org.springframework.social.connect.jdbc.JdbcConnectionRepository

断点信息

图片描述

阅读 2.8k
1 个回答

我在github上找到的答案:
https://github.com/spring-pro...
因为JdbcConnectionRepository 不是public,无法使用代理类产生,如果使用spring boot的话可以设置spring.aop.proxy-target-class=false

或者在config里
@Bean

@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public ConnectionRepository connectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication == null) {
        throw new IllegalStateException("Unable to get a ConnectionRepository: no user signed in");
    }
    return getUsersConnectionRepository(connectionFactoryLocator).createConnectionRepository(authentication.getName());
}

不适用CGLIB而使用JDK的代理
实在不行那应该就是你的spring-boot-devtools的问题,删除依赖即可

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进