DATAJDBC-572 - Polishing.

Reorder methods in EnableJdbcRepositories to match other stores. Reformat code.

Original pull request: #235.
This commit is contained in:
Mark Paluch
2020-07-13 16:26:34 +02:00
parent d3f4bce539
commit 08d71817a9
3 changed files with 44 additions and 36 deletions

View File

@@ -77,16 +77,11 @@ public @interface EnableJdbcRepositories {
Filter[] excludeFilters() default {};
/**
* Configures whether nested repository-interfaces (e.g. defined as inner classes) should be discovered by the
* repositories infrastructure.
* Returns the postfix to be used when looking up custom repository implementations. Defaults to {@literal Impl}. So
* for a repository named {@code PersonRepository} the corresponding implementation class will be looked up scanning
* for {@code PersonRepositoryImpl}.
*/
boolean considerNestedRepositories() default false;
/**
* Returns the {@link FactoryBean} class to be used for each repository instance. Defaults to
* {@link JdbcRepositoryFactoryBean}.
*/
Class<?> repositoryFactoryBeanClass() default JdbcRepositoryFactoryBean.class;
String repositoryImplementationPostfix() default "Impl";
/**
* Configures the location of where to find the Spring Data named queries properties file. Will default to
@@ -95,11 +90,23 @@ public @interface EnableJdbcRepositories {
String namedQueriesLocation() default "";
/**
* Returns the postfix to be used when looking up custom repository implementations. Defaults to {@literal Impl}. So
* for a repository named {@code PersonRepository} the corresponding implementation class will be looked up scanning
* for {@code PersonRepositoryImpl}.
* Returns the {@link FactoryBean} class to be used for each repository instance. Defaults to
* {@link JdbcRepositoryFactoryBean}.
*/
String repositoryImplementationPostfix() default "Impl";
Class<?> repositoryFactoryBeanClass() default JdbcRepositoryFactoryBean.class;
/**
* Configure the repository base class to be used to create repository proxies for this particular configuration.
*
* @since 2.1
*/
Class<?> repositoryBaseClass() default DefaultRepositoryBaseClass.class;
/**
* Configures whether nested repository-interfaces (e.g. defined as inner classes) should be discovered by the
* repositories infrastructure.
*/
boolean considerNestedRepositories() default false;
/**
* Configures the name of the {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations} bean
@@ -114,12 +121,4 @@ public @interface EnableJdbcRepositories {
*/
String dataAccessStrategyRef() default "";
/**
* Configure the repository base class to be used to create repository proxies for this particular configuration.
*
* @return
* @since 2.1
*/
Class<?> repositoryBaseClass() default DefaultRepositoryBaseClass.class;
}

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.data.jdbc.repository.support;
import java.io.Serializable;
import java.util.Optional;
import org.springframework.context.ApplicationEventPublisher;
@@ -27,7 +26,6 @@ import org.springframework.data.mapping.callback.EntityCallbacks;
import org.springframework.data.relational.core.dialect.Dialect;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.repository.query.RelationalEntityInformation;
import org.springframework.data.repository.core.EntityInformation;
import org.springframework.data.repository.core.RepositoryInformation;
import org.springframework.data.repository.core.RepositoryMetadata;

View File

@@ -133,7 +133,7 @@ public class EnableJdbcRepositoriesIntegrationTests {
@EnableJdbcRepositories(considerNestedRepositories = true,
includeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = DummyRepository.class),
jdbcOperationsRef = "qualifierJdbcOperations", dataAccessStrategyRef = "qualifierDataAccessStrategy",
repositoryBaseClass = DummyRepositoryBaseClass.class)
repositoryBaseClass = DummyRepositoryBaseClass.class)
static class TestConfiguration {
@Bean
@@ -168,52 +168,63 @@ public class EnableJdbcRepositoriesIntegrationTests {
}
}
private static class DummyRepositoryBaseClass{
private static class DummyRepositoryBaseClass<T, ID> implements CrudRepository<T, ID> {
DummyRepositoryBaseClass(JdbcAggregateTemplate template, PersistentEntity<?,?> persistentEntity) {
DummyRepositoryBaseClass(JdbcAggregateTemplate template, PersistentEntity<?, ?> persistentEntity) {
}
public Object save(Object o) {
@Override
public <S extends T> S save(S s) {
return null;
}
public Iterable saveAll(Iterable iterable) {
@Override
public <S extends T> Iterable<S> saveAll(Iterable<S> iterable) {
return null;
}
public Optional findById(Object o) {
@Override
public Optional<T> findById(ID id) {
return Optional.empty();
}
public boolean existsById(Object o) {
@Override
public boolean existsById(ID id) {
return false;
}
public Iterable findAll() {
@Override
public Iterable<T> findAll() {
return null;
}
public Iterable findAllById(Iterable iterable) {
@Override
public Iterable<T> findAllById(Iterable<ID> iterable) {
return null;
}
@Override
public long count() {
return 23L;
return 23;
}
public void deleteById(Object o) {
@Override
public void deleteById(ID id) {
}
public void delete(Object o) {
@Override
public void delete(T t) {
}
public void deleteAll(Iterable iterable) {
@Override
public void deleteAll(Iterable<? extends T> iterable) {
}
@Override
public void deleteAll() {
}