DATACMNS-952 - Switched from component scanning to SpringFactoriesLoader for internal extension points.

Both the configuration code looking up Spring Data specific Jackson modules as well as the code detecting whether we have multiple Spring Data modules on the classpath used component scanning. That can have quite significant impact on startup times.

This commit replaces the classpath scanning with the use of SpringFactoriesLoader that now requires modules that want to extend the behavior of Spring Data's web configuration or indicate a repository implementation being present by shipping a file called META-INF/spring.factories. Spring Data relies on the following keys:

- org.springframework.data.web.config.SpringDataJacksonModules - list the Spring configuration classes that will expose additional Jackson modules that are supposed to be registered for Spring Data's Jackson web support
- org.springframework.data.repository.core.support.RepositoryFactorySupport - list the Spring Data repository factory implementation class that implements repository support for your module. The general detection and configuration mechanism for user repositories is not affected by this. Currently Spring Data only uses the pure number of different entries for that key to switch into strict configuration mode in case we find more than one entry.
This commit is contained in:
Oliver Gierke
2016-12-05 10:49:10 +01:00
parent 092972824e
commit 9354800225
8 changed files with 40 additions and 69 deletions

View File

@@ -20,8 +20,7 @@ import org.springframework.context.annotation.Bean;
/**
* @author Oliver Gierke
*/
@SpringDataWebConfigurationMixin
public class SampleMixin {
public class SampleMixin implements SpringDataJacksonModules {
@Bean
String sampleBean() {