Skip to content

Commit 98233b0

Browse files
committed
Expose BeanFactory to RepositoryFactorySupport implementations.
Some implementations (Spring Data JPA especially) need access to the underlying BeanFactory. Add a protected getter. Related: spring-projects/spring-data-jpa#2162 Closes #2614
1 parent 7eb0fa0 commit 98233b0

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java

+12-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.aopalliance.intercept.MethodInvocation;
3030
import org.apache.commons.logging.Log;
3131
import org.apache.commons.logging.LogFactory;
32-
3332
import org.springframework.aop.framework.ProxyFactory;
3433
import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
3534
import org.springframework.beans.BeanUtils;
@@ -80,6 +79,7 @@
8079
* @author Christoph Strobl
8180
* @author Jens Schauder
8281
* @author John Blum
82+
* @author Greg Turnquist
8383
*/
8484
public abstract class RepositoryFactorySupport implements BeanClassLoaderAware, BeanFactoryAware {
8585

@@ -365,8 +365,7 @@ public <T> T getRepository(Class<T> repositoryInterface, RepositoryFragments fra
365365

366366
if (logger.isDebugEnabled()) {
367367
logger
368-
.debug(LogMessage.format("Finished creation of repository instance for %s.",
369-
repositoryInterface.getName()));
368+
.debug(LogMessage.format("Finished creation of repository instance for %s.", repositoryInterface.getName()));
370369
}
371370

372371
return repository;
@@ -520,6 +519,16 @@ protected void validate(RepositoryMetadata repositoryMetadata) {
520519

521520
}
522521

522+
/**
523+
* Give access to the {@link BeanFactory}.
524+
*
525+
* @return
526+
* @since 3.0
527+
*/
528+
protected BeanFactory getBeanFactory() {
529+
return this.beanFactory;
530+
}
531+
523532
/**
524533
* Creates a repository of the repository base class defined in the given {@link RepositoryInformation} using
525534
* reflection.

0 commit comments

Comments
 (0)