spring-attic / spring-social

Allows you to connect your applications with SaaS providers such as Facebook and Twitter.
http://projects.spring.io/spring-social
Apache License 2.0
619 stars 351 forks source link

JdbcConnectionRepository is package private which can lead to cglib error #232

Open pcornelissen opened 7 years ago

pcornelissen commented 7 years ago

Summary

I have a project that uses spring cloud + a few dependencies and spring-social. When I try to use the JdbcUsersConnectionRepository I get an internal server error:

There was an unexpected error (type=Internal Server Error, status=500).
Error creating bean with name 'scopedTarget.connectionRepository' defined in class path resource [org/springframework/social/config/annotation/SocialConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class org.springframework.social.connect.jdbc.JdbcConnectionRepository]: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null

Actual Behavior

JdbcConnectionRepository is package private, which leads to the error above, I don't know exactly what triggers this error in my case and not for others. You can solve this in two ways:

  1. copy the JdbcConnectionRepository and JdbcUsersConnectionRepository and make JdbcConnectionRepository public.

  2. add these two property settings:

    spring:
    aop.proxy-target-class: false
    cloud.netflix.metrics.enabled: false
  3. has the drawback that I have to change the global aop settings which lead to other funny problems, so I had to disable the netflix metrics.

Expected Behavior

No CGLib Exception ;-) Maybe just make the JdbcConnectionRepository public so CGLib can do it's thing or refactor the JdbcUsersConnectionRepository so that the JdbcConnectionRepository is not used or in another way more CGLib friendly.

Configuration

Version

spring boot 1.5.3, Spring cloud dalston.sr1

1.1.4.RELEASE 2.0.3.RELEASE ### Sample I tried to create a sample but ran into other problems, maybe I can provide one later.
thihara commented 7 years ago

Confirmed. Seeing the same thing.

tayfunyasar commented 6 years ago

I m having same error with spring-social 1.1.4.RELEASE