DATACMNS-1255 - Allow configuration of QueryLookupStrategy for CDI repositories.
Original pull request: #272.
This commit is contained in:
committed by
Oliver Gierke
parent
63fec4a32b
commit
30292101e4
@@ -44,6 +44,7 @@ import org.springframework.data.repository.config.CustomRepositoryImplementation
|
||||
import org.springframework.data.repository.config.DefaultRepositoryConfiguration;
|
||||
import org.springframework.data.repository.config.RepositoryBeanNameGenerator;
|
||||
import org.springframework.data.repository.config.SpringDataAnnotationBeanNameGenerator;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
@@ -429,5 +430,11 @@ public abstract class CdiRepositoryBean<T> implements Bean<T>, PassivationCapabl
|
||||
public String getRepositoryImplementationPostfix() {
|
||||
return DefaultRepositoryConfiguration.DEFAULT_REPOSITORY_IMPLEMENTATION_POSTFIX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryLookupStrategy.Key getQueryLookupStrategy() {
|
||||
return DefaultRepositoryConfiguration.DEFAULT_QUERY_LOOKUP_STRATEGY;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.data.repository.cdi;
|
||||
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy;
|
||||
|
||||
/**
|
||||
* Interface containing the configurable options for the Spring Data repository subsystem using CDI.
|
||||
*
|
||||
@@ -29,4 +31,13 @@ public interface CdiRepositoryConfiguration {
|
||||
* @return the postfix to use, must not be {@literal null}.
|
||||
*/
|
||||
String getRepositoryImplementationPostfix();
|
||||
|
||||
|
||||
/**
|
||||
* Return the strategy to lookup queries
|
||||
*
|
||||
* @return the lookup strategy to use
|
||||
*/
|
||||
QueryLookupStrategy.Key getQueryLookupStrategy();
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSou
|
||||
implements RepositoryConfiguration<T> {
|
||||
|
||||
public static final String DEFAULT_REPOSITORY_IMPLEMENTATION_POSTFIX = "Impl";
|
||||
private static final Key DEFAULT_QUERY_LOOKUP_STRATEGY = Key.CREATE_IF_NOT_FOUND;
|
||||
public static final Key DEFAULT_QUERY_LOOKUP_STRATEGY = Key.CREATE_IF_NOT_FOUND;
|
||||
|
||||
private final @NonNull T configurationSource;
|
||||
private final @NonNull BeanDefinition definition;
|
||||
|
||||
Reference in New Issue
Block a user