DATACMNS-891 - Added constructor to ease migration from Hopper to Ingalls.

RepositoryFactoryBeanSupport now declares both a default constructor as well as one taking the repository interface as argument like we're going to progress in Ingalls. This allows implementations to tweak their Hopper compatible extensions of the class to also declare both constructors. That causes them to stay compatible with Hopper (which will use the setter) but also run on Ingalls which will use constructor injection.
This commit is contained in:
Oliver Gierke
2016-12-16 19:04:25 +01:00
parent ba4c7b11c9
commit 6df18e1438

View File

@@ -67,6 +67,20 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>,
private RepositoryMetadata repositoryMetadata;
protected RepositoryFactoryBeanSupport() {}
/**
* Creates a new {@link RepositoryFactoryBeanSupport} for the given repository interface.
*
* @param repositoryInterface must not be {@literal null}.
*/
protected RepositoryFactoryBeanSupport(Class<? extends T> repositoryInterface) {
Assert.notNull(repositoryInterface, "Repository interface must not be null on initialization!");
this.repositoryInterface = repositoryInterface;
}
/**
* Setter to inject the repository interface to implement.
*