鍍金池/ 問答/網(wǎng)絡(luò)安全/ 使用spring social獲得本網(wǎng)站的鏈接/connet時候報如下問題?

使用spring social獲得本網(wǎng)站的鏈接/connet時候報如下問題?

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

斷點(diǎn)信息

圖片描述

回答
編輯回答
喵小咪

我在github上找到的答案:
https://github.com/spring-pro...
因為JdbcConnectionRepository 不是public,無法使用代理類產(chǎn)生,如果使用spring boot的話可以設(shè)置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的代理
實在不行那應(yīng)該就是你的spring-boot-devtools的問題,刪除依賴即可

2017年1月14日 04:29