From 6df18e1438b17da2bc73e5df44f45cfd5f2f1d24 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Fri, 16 Dec 2016 19:04:25 +0100 Subject: [PATCH] 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. --- .../core/support/RepositoryFactoryBeanSupport.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/org/springframework/data/repository/core/support/RepositoryFactoryBeanSupport.java b/src/main/java/org/springframework/data/repository/core/support/RepositoryFactoryBeanSupport.java index 12ef4656c..ceb5067f5 100644 --- a/src/main/java/org/springframework/data/repository/core/support/RepositoryFactoryBeanSupport.java +++ b/src/main/java/org/springframework/data/repository/core/support/RepositoryFactoryBeanSupport.java @@ -67,6 +67,20 @@ public abstract class RepositoryFactoryBeanSupport, 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 repositoryInterface) { + + Assert.notNull(repositoryInterface, "Repository interface must not be null on initialization!"); + + this.repositoryInterface = repositoryInterface; + } + /** * Setter to inject the repository interface to implement. *