DATACMNS-1538 - Repository proxy post processors in CDI.
Add support for custom repository proxy post processors in CDI. Original pull request: #396.
This commit is contained in:
committed by
Jens Schauder
parent
0f1d4970ef
commit
098842765d
@@ -58,6 +58,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Peter Rietzler
|
||||
* @author Jens Schauder
|
||||
* @author Christoph Strobl
|
||||
* @author Ariel Carrera
|
||||
*/
|
||||
public abstract class CdiRepositoryBean<T> implements Bean<T>, PassivationCapable {
|
||||
|
||||
@@ -484,6 +485,8 @@ public abstract class CdiRepositoryBean<T> implements Bean<T>, PassivationCapabl
|
||||
configuration.getNamedQueries().ifPresent(repositoryFactory::setNamedQueries);
|
||||
configuration.getQueryLookupStrategy().ifPresent(repositoryFactory::setQueryLookupStrategyKey);
|
||||
configuration.getRepositoryBeanClass().ifPresent(repositoryFactory::setRepositoryBaseClass);
|
||||
configuration.getRepositoryProxyPostProcessors().forEach(repositoryFactory::addRepositoryProxyPostProcessor);
|
||||
configuration.getQueryCreationListeners().forEach(repositoryFactory::addQueryCreationListener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,9 +16,13 @@
|
||||
|
||||
package org.springframework.data.repository.cdi;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.repository.core.NamedQueries;
|
||||
import org.springframework.data.repository.core.support.QueryCreationListener;
|
||||
import org.springframework.data.repository.core.support.RepositoryProxyPostProcessor;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy;
|
||||
import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider;
|
||||
|
||||
@@ -27,6 +31,7 @@ import org.springframework.data.repository.query.QueryMethodEvaluationContextPro
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Fabian Henniges
|
||||
* @author Ariel Carrera
|
||||
*/
|
||||
public interface CdiRepositoryConfiguration {
|
||||
|
||||
@@ -79,4 +84,28 @@ public interface CdiRepositoryConfiguration {
|
||||
default String getRepositoryImplementationPostfix() {
|
||||
return "Impl";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of {@link RepositoryProxyPostProcessor} to be used during repository proxy creation. Can be
|
||||
* {@link Collections#emptyList()} .
|
||||
*
|
||||
* @return the list of repository proxy post processors to use, can be {@link Collections#emptyList()}, must not be
|
||||
* {@literal null}.
|
||||
* @since 2.2
|
||||
*/
|
||||
default List<RepositoryProxyPostProcessor> getRepositoryProxyPostProcessors() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of {@link QueryCreationListener} to be used during repository proxy creation. Can be
|
||||
* {@link Collections#emptyList()} .
|
||||
*
|
||||
* @return the list query creation listeners to use, can be {@link Collections#emptyList()}, must not be
|
||||
* {@literal null}.
|
||||
* @since 2.2
|
||||
*/
|
||||
default List<QueryCreationListener<?>> getQueryCreationListeners() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user