spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.53k stars 38.12k forks source link

Configuration class parsing may trigger NoClassDefFoundError for nested classes [SPR-13091] #17682

Closed spring-projects-issues closed 9 years ago

spring-projects-issues commented 9 years ago

Dave Syer opened SPR-13091 and commented

Interestingly, it's not configuration class parsing itself, it's the fallback isLiteConfigurationCandidate check looking for the presence of @Bean methods on non-@Configuration classes which may fail with a NoClassDefFoundError. Making that check more defensive now allows for ignoring any nested classes which cannot be fully resolved, simply not considering them as configuration class candidates to begin with.

That said, Spring Cloud's ServiceConnectionFactory is a fragile affair in any case, even as a top-level class. Doesn't it drag in all sorts of external dependencies through its method return types? This may work for scenarios where only specific methods are being called but will fail at any general introspection attempt if some dependencies are not actually present...

Juergen


Affects: 4.1.6, 4.2 RC1

Reference URL: https://github.com/spring-cloud/spring-cloud-connectors/issues/88

spring-projects-issues commented 9 years ago

Stéphane Nicoll commented

This comment in the Spring Cloud issue in particular makes me think that maybe there's an issue on our side.

There is also a sample project we can use (without Scott's fix)