Spring-boot: Apps that depend on spring-social-github fail to start

Created on 29 May 2014  路  11Comments  路  Source: spring-projects/spring-boot

The failure is

Caused by: java.io.FileNotFoundException: class path resource [org/springframework/social/config/annotation/SocialConfigurerAdapter.class] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:82)
    at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:77)
    at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:563)
    at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:726)
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:287)
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:218)
    at org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(ConfigurationClassParser.java:307)
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:235)
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:218)
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:438)
    at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:392)
    ... 57 more

I think it's because Spring Social GitHub depends on Spring Social 1.1.0.M4 which, I'm guessing, doesn't have org/springframework/social/config/annotation/SocialConfigurerAdapter.class

bug

Most helpful comment

I come across this problem because I put my main class(the class tags by @SpringBootApplication) in my root path.
For instance : my root path is like this :

src 
  |
  |--- main
          |----- java
                    |----- com.charlie.example
                    |----- Application.class

I move Application.class to package com.charlie.example and this works fine, hope it's helpful for others who meets this issue.

All 11 comments

SocialWebAutoConfiguration is kicking in as ConnectController is on the classpath. This causes SocialAutoConfigurationAdapter to be loaded. This fails as it extends SocialConfigurerAdapter which isn't on the classpath.

It'd be nice to fix this without requiring users of spring-social-github to force their build system to replace the 1.1.0.M4 artifacts with the 1.1.0.RELEASE ones. One option would be to do a release of Spring Social Github that depends on 1.1.0.RELEASE of Spring Social, another would be to add @ConditionalOnClass(SocialConfigurerAdapter.class) to SocialWebAutoConfiguration.

@habuma what's your take?

Do we need to fix this for 1.1.0? Is it a blocker?

I'm undecided. Spring Social GitHub hasn't made it to GA yet so I'm inclined to say no. That said adding @ConditionalOnClass(SocialConfigurerAdapter.class) will fix it with very little downside.

I come across this problem because I put my main class(the class tags by @SpringBootApplication) in my root path.
For instance : my root path is like this :

src 
  |
  |--- main
          |----- java
                    |----- com.charlie.example
                    |----- Application.class

I move Application.class to package com.charlie.example and this works fine, hope it's helpful for others who meets this issue.

@FireInTheWall thanks it's working

@FireInTheWall Thank you. I was having the same issue. Followed your solution and it works.. :)

@FireInTheWall Thank you that works for me . BUT why this problem happens?

Other projects work well, that main class(the class tags by @springbootapplication) in my root path.

@FireInTheWall Because of your solution I saved a lot of time, Thank You!

me too! @FireInTheWall Thank u! But why?

@GamzeAkbal1 Please don't spam multiple issues with the same question. As noted in the migration guide, auto-configuration for Spring Social has been removed in Spring Boot 2.0. If you have further questions then, as requested in the guidelines for contributing, please ask on Stack Overflow or Gitter.

Was this page helpful?
0 / 5 - 0 ratings