Browse Source

Removed deprecations.

Removed deprecated API and usasage of deprecated API.

Closes #1340
pull/1345/head
Jens Schauder 3 years ago
parent
commit
f326897950
  1. 15
      spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/BasicJdbcConverter.java
  2. 16
      spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/QueryMapper.java
  3. 5
      spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/query/StringBasedJdbcQuery.java
  4. 4
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/BasicJdbcConverterUnitTests.java
  5. 5
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/BasicRelationalConverterAggregateReferenceUnitTests.java
  6. 4
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/EntityRowMapperUnitTests.java
  7. 6
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/config/JdbcRepositoryConfigExtensionUnitTests.java
  8. 4
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/query/JdbcQueryMethodUnitTests.java
  9. 5
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategyUnitTests.java
  10. 15
      spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/convert/MappingR2dbcConverter.java
  11. 15
      spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/convert/R2dbcCustomConversions.java
  12. 18
      spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/query/QueryMapper.java
  13. 9
      spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/repository/query/R2dbcQueryMethod.java
  14. 9
      spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/repository/AbstractR2dbcRepositoryIntegrationTests.java
  15. 8
      spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/repository/AbstractR2dbcRepositoryWithMixedCaseNamesIntegrationTests.java
  16. 7
      spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/repository/config/R2dbcRepositoryConfigurationExtensionUnitTests.java
  17. 5
      spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/testing/ExternalDatabase.java
  18. 2
      spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/testing/OracleConnectionFactoryProviderWrapper.java
  19. 3
      spring-data-relational/src/main/java/org/springframework/data/relational/core/conversion/BasicRelationalConverter.java
  20. 11
      spring-data-relational/src/test/java/org/springframework/data/relational/core/conversion/BasicRelationalConverterUnitTests.java

15
spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/BasicJdbcConverter.java

@ -33,6 +33,7 @@ import org.springframework.data.convert.CustomConversions; @@ -33,6 +33,7 @@ import org.springframework.data.convert.CustomConversions;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.jdbc.core.mapping.JdbcValue;
import org.springframework.data.jdbc.support.JdbcUtil;
import org.springframework.data.mapping.InstanceCreatorMetadata;
import org.springframework.data.mapping.Parameter;
import org.springframework.data.mapping.PersistentPropertyAccessor;
import org.springframework.data.mapping.PersistentPropertyPath;
@ -50,7 +51,7 @@ import org.springframework.data.relational.core.mapping.PersistentPropertyPathEx @@ -50,7 +51,7 @@ import org.springframework.data.relational.core.mapping.PersistentPropertyPathEx
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
@ -267,7 +268,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc @@ -267,7 +268,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
return jdbcValue;
}
Object convertedValue = writeValue(value, ClassTypeInformation.from(columnType));
Object convertedValue = writeValue(value, TypeInformation.of(columnType));
if (convertedValue == null || !convertedValue.getClass().isArray()) {
@ -293,7 +294,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc @@ -293,7 +294,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
if (canWriteAsJdbcValue(value)) {
Object converted = writeValue(value, ClassTypeInformation.from(JdbcValue.class));
Object converted = writeValue(value, TypeInformation.of(JdbcValue.class));
if (converted instanceof JdbcValue) {
return (JdbcValue) converted;
}
@ -414,11 +415,11 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc @@ -414,11 +415,11 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
private T populateProperties(T instance, @Nullable Object idValue) {
PersistentPropertyAccessor<T> propertyAccessor = getPropertyAccessor(entity, instance);
PreferredConstructor<T, RelationalPersistentProperty> persistenceConstructor = entity.getPersistenceConstructor();
InstanceCreatorMetadata<RelationalPersistentProperty> creatorMetadata = entity.getInstanceCreatorMetadata();
entity.doWithAll(property -> {
if (persistenceConstructor != null && persistenceConstructor.isConstructorParameter(property)) {
if (creatorMetadata != null && creatorMetadata.isCreatorParameter(property)) {
return;
}
@ -548,10 +549,10 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc @@ -548,10 +549,10 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
private T createInstanceInternal(@Nullable Object idValue) {
PreferredConstructor<T, RelationalPersistentProperty> persistenceConstructor = entity.getPersistenceConstructor();
InstanceCreatorMetadata<RelationalPersistentProperty> creatorMetadata = entity.getInstanceCreatorMetadata();
ParameterValueProvider<RelationalPersistentProperty> provider;
if (persistenceConstructor != null && persistenceConstructor.hasParameters()) {
if (creatorMetadata != null && creatorMetadata.hasParameters()) {
SpELExpressionEvaluator expressionEvaluator = new DefaultSpELExpressionEvaluator(accessor, spELContext);
provider = new SpELExpressionParameterValueProvider<>(expressionEvaluator, getConversionService(),

16
spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/QueryMapper.java

@ -41,7 +41,7 @@ import org.springframework.data.relational.core.query.CriteriaDefinition; @@ -41,7 +41,7 @@ import org.springframework.data.relational.core.query.CriteriaDefinition;
import org.springframework.data.relational.core.query.CriteriaDefinition.Comparator;
import org.springframework.data.relational.core.query.ValueFunction;
import org.springframework.data.relational.core.sql.*;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.data.util.Pair;
import org.springframework.data.util.TypeInformation;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
@ -441,11 +441,11 @@ public class QueryMapper { @@ -441,11 +441,11 @@ public class QueryMapper {
Object first = convertValue(pair.getFirst(), typeInformation.getActualType() != null //
? typeInformation.getRequiredActualType()
: ClassTypeInformation.OBJECT);
: TypeInformation.OBJECT);
Object second = convertValue(pair.getSecond(), typeInformation.getActualType() != null //
? typeInformation.getRequiredActualType()
: ClassTypeInformation.OBJECT);
: TypeInformation.OBJECT);
return Pair.of(first, second);
}
@ -457,14 +457,14 @@ public class QueryMapper { @@ -457,14 +457,14 @@ public class QueryMapper {
for (Object o : (Iterable<?>) value) {
mapped.add(convertValue(o, typeInformation.getActualType() != null ? typeInformation.getRequiredActualType()
: ClassTypeInformation.OBJECT));
: TypeInformation.OBJECT));
}
return mapped;
}
if (value.getClass().isArray()
&& (ClassTypeInformation.OBJECT.equals(typeInformation) || typeInformation.isCollectionLike())) {
&& (TypeInformation.OBJECT.equals(typeInformation) || typeInformation.isCollectionLike())) {
return value;
}
@ -587,7 +587,7 @@ public class QueryMapper { @@ -587,7 +587,7 @@ public class QueryMapper {
private Expression bindBoolean(Column column, MapSqlParameterSource parameterSource, boolean value) {
Object converted = converter.writeValue(value, ClassTypeInformation.OBJECT);
Object converted = converter.writeValue(value, TypeInformation.OBJECT);
return bind(converted, JDBCType.BIT, parameterSource, column.getName().getReference());
}
@ -678,7 +678,7 @@ public class QueryMapper { @@ -678,7 +678,7 @@ public class QueryMapper {
}
public TypeInformation<?> getTypeHint() {
return ClassTypeInformation.OBJECT;
return TypeInformation.OBJECT;
}
public SQLType getSqlType() {
@ -808,7 +808,7 @@ public class QueryMapper { @@ -808,7 +808,7 @@ public class QueryMapper {
}
if (this.property.getType().isPrimitive()) {
return ClassTypeInformation.from(ClassUtils.resolvePrimitiveIfNecessary(this.property.getType()));
return TypeInformation.of(ClassUtils.resolvePrimitiveIfNecessary(this.property.getType()));
}
if (this.property.getType().isArray()) {

5
spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/query/StringBasedJdbcQuery.java

@ -45,7 +45,6 @@ import org.springframework.lang.Nullable; @@ -45,7 +45,6 @@ import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
/**
* A query to be executed based on a repository method, it's annotated SQL query and the arguments provided to the
@ -211,7 +210,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery { @@ -211,7 +210,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
String resultSetExtractorRef = queryMethod.getResultSetExtractorRef();
if (!StringUtils.isEmpty(resultSetExtractorRef)) {
if (!ObjectUtils.isEmpty(resultSetExtractorRef)) {
Assert.notNull(beanFactory, "When a ResultSetExtractorRef is specified the BeanFactory must not be null");
@ -253,7 +252,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery { @@ -253,7 +252,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
String rowMapperRef = queryMethod.getRowMapperRef();
if (!StringUtils.isEmpty(rowMapperRef)) {
if (!ObjectUtils.isEmpty(rowMapperRef)) {
Assert.notNull(beanFactory, "When a RowMapperRef is specified the BeanFactory must not be null");

4
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/BasicJdbcConverterUnitTests.java

@ -44,7 +44,7 @@ import org.springframework.data.jdbc.support.JdbcUtil; @@ -44,7 +44,7 @@ import org.springframework.data.jdbc.support.JdbcUtil;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
/**
* Unit tests for {@link BasicJdbcConverter}.
@ -147,7 +147,7 @@ public class BasicJdbcConverterUnitTests { @@ -147,7 +147,7 @@ public class BasicJdbcConverterUnitTests {
RelationalPersistentProperty property = persistentEntity.getRequiredPersistentProperty(propertyName);
Object converted = converter.writeValue(value, ClassTypeInformation.from(converter.getColumnType(property)));
Object converted = converter.writeValue(value, TypeInformation.of(converter.getColumnType(property)));
Object convertedBack = converter.readValue(converted, property.getTypeInformation());
softly.assertThat(convertedBack).describedAs(propertyName).isEqualTo(value);

5
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/BasicRelationalConverterAggregateReferenceUnitTests.java

@ -20,13 +20,12 @@ import static org.mockito.Mockito.*; @@ -20,13 +20,12 @@ import static org.mockito.Mockito.*;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
/**
* Unit tests for the handling of {@link AggregateReference}s in the
@ -59,7 +58,7 @@ public class BasicRelationalConverterAggregateReferenceUnitTests { @@ -59,7 +58,7 @@ public class BasicRelationalConverterAggregateReferenceUnitTests {
AggregateReference<Object, Integer> reference = AggregateReference.to(23);
Object writeValue = converter.writeValue(reference, ClassTypeInformation.from(converter.getColumnType(property)));
Object writeValue = converter.writeValue(reference, TypeInformation.of(converter.getColumnType(property)));
Assertions.assertThat(writeValue).isEqualTo(23L);
}

4
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/EntityRowMapperUnitTests.java

@ -49,7 +49,7 @@ import org.mockito.ArgumentMatchers; @@ -49,7 +49,7 @@ import org.mockito.ArgumentMatchers;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.annotation.PersistenceCreator;
import org.springframework.data.annotation.Transient;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
@ -755,7 +755,7 @@ public class EntityRowMapperUnitTests { @@ -755,7 +755,7 @@ public class EntityRowMapperUnitTests {
String two;
final String three;
@PersistenceConstructor
@PersistenceCreator
MixedProperties(String one) {
this.one = one;
this.three = "unset";

6
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/config/JdbcRepositoryConfigExtensionUnitTests.java

@ -26,7 +26,7 @@ import org.springframework.core.env.Environment; @@ -26,7 +26,7 @@ import org.springframework.core.env.Environment;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.type.StandardAnnotationMetadata;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.data.relational.core.mapping.Table;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource;
@ -40,13 +40,13 @@ import org.springframework.data.repository.config.RepositoryConfigurationSource; @@ -40,13 +40,13 @@ import org.springframework.data.repository.config.RepositoryConfigurationSource;
*/
public class JdbcRepositoryConfigExtensionUnitTests {
StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(Config.class, true);
AnnotationMetadata metadata = AnnotationMetadata.introspect(Config.class);
ResourceLoader loader = new PathMatchingResourcePatternResolver();
Environment environment = new StandardEnvironment();
BeanDefinitionRegistry registry = new DefaultListableBeanFactory();
RepositoryConfigurationSource configurationSource = new AnnotationRepositoryConfigurationSource(metadata,
EnableJdbcRepositories.class, loader, environment, registry);
EnableJdbcRepositories.class, loader, environment, registry, null);
@Test // DATAJPA-437
public void isStrictMatchOnlyIfDomainTypeIsAnnotatedWithDocument() {

4
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/query/JdbcQueryMethodUnitTests.java

@ -32,7 +32,7 @@ import org.springframework.data.relational.repository.Lock; @@ -32,7 +32,7 @@ import org.springframework.data.relational.repository.Lock;
import org.springframework.data.repository.core.NamedQueries;
import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.core.support.PropertiesBasedNamedQueries;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.jdbc.core.RowMapper;
/**
@ -67,7 +67,7 @@ public class JdbcQueryMethodUnitTests { @@ -67,7 +67,7 @@ public class JdbcQueryMethodUnitTests {
metadata = mock(RepositoryMetadata.class);
doReturn(String.class).when(metadata).getReturnedDomainClass(any(Method.class));
doReturn(ClassTypeInformation.from(String.class)).when(metadata).getReturnType(any(Method.class));
doReturn(TypeInformation.of(String.class)).when(metadata).getReturnType(any(Method.class));
}
@Test // DATAJDBC-165

5
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/support/JdbcQueryLookupStrategyUnitTests.java

@ -25,7 +25,6 @@ import java.util.stream.Stream; @@ -25,7 +25,6 @@ import java.util.stream.Stream;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
@ -42,7 +41,7 @@ import org.springframework.data.repository.core.NamedQueries; @@ -42,7 +41,7 @@ import org.springframework.data.repository.core.NamedQueries;
import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.query.QueryLookupStrategy;
import org.springframework.data.repository.query.RepositoryQuery;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
@ -77,7 +76,7 @@ class JdbcQueryLookupStrategyUnitTests { @@ -77,7 +76,7 @@ class JdbcQueryLookupStrategyUnitTests {
this.metadata = mock(RepositoryMetadata.class);
doReturn(NumberFormat.class).when(metadata).getReturnedDomainClass(any(Method.class));
doReturn(ClassTypeInformation.from(NumberFormat.class)).when(metadata).getReturnType(any(Method.class));
doReturn(TypeInformation.of(NumberFormat.class)).when(metadata).getReturnType(any(Method.class));
}
@Test // DATAJDBC-166

15
spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/convert/MappingR2dbcConverter.java

@ -50,7 +50,6 @@ import org.springframework.data.relational.core.conversion.RelationalConverter; @@ -50,7 +50,6 @@ import org.springframework.data.relational.core.conversion.RelationalConverter;
import org.springframework.data.relational.core.dialect.ArrayColumns;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
import org.springframework.r2dbc.core.Parameter;
@ -107,7 +106,7 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R @@ -107,7 +106,7 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R
@Override
public <R> R read(Class<R> type, Row row, @Nullable RowMetadata metadata) {
TypeInformation<? extends R> typeInfo = ClassTypeInformation.from(type);
TypeInformation<? extends R> typeInfo = TypeInformation.of(type);
Class<? extends R> rawType = typeInfo.getType();
if (Row.class.isAssignableFrom(rawType)) {
@ -132,7 +131,7 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R @@ -132,7 +131,7 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R
for (RelationalPersistentProperty property : entity) {
if (entity.isConstructorArgument(property)) {
if (entity.isCreatorArgument(property)) {
continue;
}
@ -185,12 +184,10 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R @@ -185,12 +184,10 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R
return readValue(value, property.getTypeInformation());
} catch (Exception o_O) {
throw new MappingException(String.format("Could not read property %s from column %s", property, identifier),
o_O);
throw new MappingException(String.format("Could not read property %s from column %s", property, identifier), o_O);
}
}
public Object readValue(@Nullable Object value, TypeInformation<?> type) {
if (null == value) {
@ -224,7 +221,7 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R @@ -224,7 +221,7 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R
TypeInformation<?> componentType = targetType.getComponentType() != null //
? targetType.getComponentType() //
: ClassTypeInformation.OBJECT;
: TypeInformation.OBJECT;
Class<?> rawComponentType = componentType.getType();
Collection<Object> items = targetType.getType().isArray() //
@ -302,7 +299,7 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R @@ -302,7 +299,7 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R
getConversionService());
for (RelationalPersistentProperty p : entity) {
if (!entity.isConstructorArgument(property)) {
if (!entity.isCreatorArgument(property)) {
propertyAccessor.setProperty(p, readFrom(row, metadata, p, prefix));
}
}
@ -405,7 +402,7 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R @@ -405,7 +402,7 @@ public class MappingR2dbcConverter extends BasicRelationalConverter implements R
private void writePropertyInternal(OutboundRow sink, Object value, boolean isNew,
RelationalPersistentProperty property) {
TypeInformation<?> valueType = ClassTypeInformation.from(value.getClass());
TypeInformation<?> valueType = TypeInformation.of(value.getClass());
if (valueType.isCollectionLike()) {

15
spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/convert/R2dbcCustomConversions.java

@ -16,6 +16,7 @@ import org.springframework.data.r2dbc.mapping.R2dbcSimpleTypeHolder; @@ -16,6 +16,7 @@ import org.springframework.data.r2dbc.mapping.R2dbcSimpleTypeHolder;
* {@link org.springframework.data.mapping.model.SimpleTypeHolder}
*
* @author Mark Paluch
* @author Jens Schauder
* @see CustomConversions
* @see org.springframework.data.mapping.model.SimpleTypeHolder
*/
@ -33,20 +34,6 @@ public class R2dbcCustomConversions extends CustomConversions { @@ -33,20 +34,6 @@ public class R2dbcCustomConversions extends CustomConversions {
STORE_CONVERSIONS = StoreConversions.of(R2dbcSimpleTypeHolder.HOLDER, STORE_CONVERTERS);
}
/**
* Create a new {@link R2dbcCustomConversions} instance registering the given converters.
*
* @param converters must not be {@literal null}.
* @deprecated since 1.3, use {@link #of(R2dbcDialect, Object...)} or
* {@link #R2dbcCustomConversions(StoreConversions, Collection)} directly to consider dialect-native
* simple types. Use {@link CustomConversions.StoreConversions#NONE} to omit store-specific converters.
*/
@Deprecated
public R2dbcCustomConversions(Collection<?> converters) {
super(new R2dbcCustomConversionsConfiguration(STORE_CONVERSIONS,
converters instanceof List ? (List<?>) converters : new ArrayList<>(converters)));
}
/**
* Create a new {@link R2dbcCustomConversions} instance registering the given converters.
*

18
spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/query/QueryMapper.java

@ -38,7 +38,7 @@ import org.springframework.data.relational.core.query.CriteriaDefinition; @@ -38,7 +38,7 @@ import org.springframework.data.relational.core.query.CriteriaDefinition;
import org.springframework.data.relational.core.query.CriteriaDefinition.Comparator;
import org.springframework.data.relational.core.query.ValueFunction;
import org.springframework.data.relational.core.sql.*;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.data.util.Pair;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
@ -392,7 +392,7 @@ public class QueryMapper { @@ -392,7 +392,7 @@ public class QueryMapper {
return Parameter.empty(converter.getTargetType(value.getType()));
}
return Parameter.from(convertValue(value.getValue(), ClassTypeInformation.OBJECT));
return Parameter.from(convertValue(value.getValue(), TypeInformation.OBJECT));
}
@Nullable
@ -408,11 +408,11 @@ public class QueryMapper { @@ -408,11 +408,11 @@ public class QueryMapper {
Object first = convertValue(pair.getFirst(),
typeInformation.getActualType() != null ? typeInformation.getRequiredActualType()
: ClassTypeInformation.OBJECT);
: TypeInformation.OBJECT);
Object second = convertValue(pair.getSecond(),
typeInformation.getActualType() != null ? typeInformation.getRequiredActualType()
: ClassTypeInformation.OBJECT);
: TypeInformation.OBJECT);
return Pair.of(first, second);
}
@ -423,14 +423,14 @@ public class QueryMapper { @@ -423,14 +423,14 @@ public class QueryMapper {
for (Object o : (Iterable<?>) value) {
mapped.add(convertValue(o, typeInformation.getActualType() != null ? typeInformation.getRequiredActualType()
: ClassTypeInformation.OBJECT));
: TypeInformation.OBJECT));
}
return mapped;
}
if (value.getClass().isArray()
&& (ClassTypeInformation.OBJECT.equals(typeInformation) || typeInformation.isCollectionLike())) {
&& (TypeInformation.OBJECT.equals(typeInformation) || typeInformation.isCollectionLike())) {
return value;
}
@ -633,7 +633,7 @@ public class QueryMapper { @@ -633,7 +633,7 @@ public class QueryMapper {
}
public TypeInformation<?> getTypeHint() {
return ClassTypeInformation.OBJECT;
return TypeInformation.OBJECT;
}
}
@ -734,7 +734,7 @@ public class QueryMapper { @@ -734,7 +734,7 @@ public class QueryMapper {
}
if (this.property.getType().isPrimitive()) {
return ClassTypeInformation.from(ClassUtils.resolvePrimitiveIfNecessary(this.property.getType()));
return TypeInformation.of(ClassUtils.resolvePrimitiveIfNecessary(this.property.getType()));
}
if (this.property.getType().isArray()) {
@ -743,7 +743,7 @@ public class QueryMapper { @@ -743,7 +743,7 @@ public class QueryMapper {
if (this.property.getType().isInterface()
|| (java.lang.reflect.Modifier.isAbstract(this.property.getType().getModifiers()))) {
return ClassTypeInformation.OBJECT;
return TypeInformation.OBJECT;
}
return this.property.getTypeInformation();

9
spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/repository/query/R2dbcQueryMethod.java

@ -28,11 +28,11 @@ import org.springframework.data.domain.Slice; @@ -28,11 +28,11 @@ import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.projection.ProjectionFactory;
import org.springframework.data.relational.repository.Lock;
import org.springframework.data.r2dbc.repository.Modifying;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.repository.Lock;
import org.springframework.data.relational.repository.query.RelationalEntityMetadata;
import org.springframework.data.relational.repository.query.RelationalParameters;
import org.springframework.data.relational.repository.query.SimpleRelationalEntityMetadata;
@ -41,7 +41,6 @@ import org.springframework.data.repository.query.Parameter; @@ -41,7 +41,6 @@ import org.springframework.data.repository.query.Parameter;
import org.springframework.data.repository.query.QueryMethod;
import org.springframework.data.repository.util.ReactiveWrapperConverters;
import org.springframework.data.repository.util.ReactiveWrappers;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.Lazy;
import org.springframework.data.util.ReflectionUtils;
import org.springframework.data.util.TypeInformation;
@ -59,10 +58,10 @@ import org.springframework.util.ClassUtils; @@ -59,10 +58,10 @@ import org.springframework.util.ClassUtils;
public class R2dbcQueryMethod extends QueryMethod {
@SuppressWarnings("rawtypes") //
private static final ClassTypeInformation<Page> PAGE_TYPE = ClassTypeInformation.from(Page.class);
private static final TypeInformation<Page> PAGE_TYPE = TypeInformation.of(Page.class);
@SuppressWarnings("rawtypes") //
private static final ClassTypeInformation<Slice> SLICE_TYPE = ClassTypeInformation.from(Slice.class);
private static final TypeInformation<Slice> SLICE_TYPE = TypeInformation.of(Slice.class);
private final MappingContext<? extends RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> mappingContext;
private final Optional<Query> query;
@ -91,7 +90,7 @@ public class R2dbcQueryMethod extends QueryMethod { @@ -91,7 +90,7 @@ public class R2dbcQueryMethod extends QueryMethod {
if (hasParameterOfType(method, Pageable.class)) {
TypeInformation<?> returnType = ClassTypeInformation.fromReturnTypeOf(method);
TypeInformation<?> returnType = TypeInformation.fromReturnTypeOf(method);
boolean multiWrapper = ReactiveWrappers.isMultiValueType(returnType.getType());
boolean singleWrapperWithWrappedPageableResult = ReactiveWrappers.isSingleValueType(returnType.getType())

9
spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/repository/AbstractR2dbcRepositoryIntegrationTests.java

@ -23,8 +23,6 @@ import lombok.Getter; @@ -23,8 +23,6 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.Value;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.repository.Lock;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Hooks;
import reactor.core.publisher.Mono;
@ -39,16 +37,17 @@ import javax.sql.DataSource; @@ -39,16 +37,17 @@ import javax.sql.DataSource;
import org.assertj.core.api.Condition;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.annotation.PersistenceCreator;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.r2dbc.repository.support.R2dbcRepositoryFactory;
import org.springframework.data.r2dbc.testing.R2dbcIntegrationTestSupport;
import org.springframework.data.relational.core.mapping.Table;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.repository.Lock;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import org.springframework.jdbc.core.JdbcTemplate;
@ -479,7 +478,7 @@ public abstract class AbstractR2dbcRepositoryIntegrationTests extends R2dbcInteg @@ -479,7 +478,7 @@ public abstract class AbstractR2dbcRepositoryIntegrationTests extends R2dbcInteg
Integer manual;
boolean flag;
@PersistenceConstructor
@PersistenceCreator
LegoSet(Integer id, String name, Integer manual) {
super(id);
this.name = name;

8
spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/repository/AbstractR2dbcRepositoryWithMixedCaseNamesIntegrationTests.java

@ -35,7 +35,7 @@ import org.junit.jupiter.api.Test; @@ -35,7 +35,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.annotation.PersistenceCreator;
import org.springframework.data.r2dbc.testing.R2dbcIntegrationTestSupport;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
@ -126,13 +126,15 @@ public abstract class AbstractR2dbcRepositoryWithMixedCaseNamesIntegrationTests @@ -126,13 +126,15 @@ public abstract class AbstractR2dbcRepositoryWithMixedCaseNamesIntegrationTests
@NoArgsConstructor
public static class LegoSet {
@Nullable @Column("Id") @Id Integer id;
@Nullable
@Column("Id")
@Id Integer id;
@Column("Name") String name;
@Column("Manual") Integer manual;
@PersistenceConstructor
@PersistenceCreator
LegoSet(@Nullable Integer id, String name, Integer manual) {
this.id = id;
this.name = name;

7
spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/repository/config/R2dbcRepositoryConfigurationExtensionUnitTests.java

@ -26,7 +26,7 @@ import org.springframework.core.env.Environment; @@ -26,7 +26,7 @@ import org.springframework.core.env.Environment;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.type.StandardAnnotationMetadata;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.data.relational.core.mapping.Table;
import org.springframework.data.repository.CrudRepository;
@ -43,14 +43,13 @@ import org.springframework.data.repository.reactive.ReactiveCrudRepository; @@ -43,14 +43,13 @@ import org.springframework.data.repository.reactive.ReactiveCrudRepository;
*/
class R2dbcRepositoryConfigurationExtensionUnitTests {
private final StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(Config.class, true);
private final AnnotationMetadata metadata = AnnotationMetadata.introspect(Config.class);
private final ResourceLoader loader = new PathMatchingResourcePatternResolver();
private final Environment environment = new StandardEnvironment();
private final BeanDefinitionRegistry registry = new DefaultListableBeanFactory();
private final RepositoryConfigurationSource configurationSource = new AnnotationRepositoryConfigurationSource(
metadata,
EnableR2dbcRepositories.class, loader, environment, registry);
metadata, EnableR2dbcRepositories.class, loader, environment, registry);
@Test // gh-13
void isStrictMatchIfDomainTypeIsAnnotatedWithDocument() {

5
spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/testing/ExternalDatabase.java

@ -85,8 +85,7 @@ public abstract class ExternalDatabase implements BeforeAllCallback { @@ -85,8 +85,7 @@ public abstract class ExternalDatabase implements BeforeAllCallback {
public void beforeAll(ExtensionContext context) {
if (!checkValidity()) {
throw new TestAbortedException(
String.format("Cannot connect to %s. Skipping tests.", this));
throw new TestAbortedException(String.format("Cannot connect to %s. Skipping tests.", this));
}
}
@ -134,7 +133,7 @@ public abstract class ExternalDatabase implements BeforeAllCallback { @@ -134,7 +133,7 @@ public abstract class ExternalDatabase implements BeforeAllCallback {
*/
public static ProvidedDatabaseBuilder builder(JdbcDatabaseContainer container) {
return builder().hostname(container.getContainerIpAddress()) //
return builder().hostname(container.getHost()) //
.port(container.getFirstMappedPort()) //
.username(container.getUsername()) //
.password(container.getPassword()) //

2
spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/testing/OracleConnectionFactoryProviderWrapper.java

@ -47,7 +47,7 @@ public class OracleConnectionFactoryProviderWrapper implements ConnectionFactory @@ -47,7 +47,7 @@ public class OracleConnectionFactoryProviderWrapper implements ConnectionFactory
try {
return (ConnectionFactoryProvider) Class.forName("oracle.r2dbc.impl.OracleConnectionFactoryProviderImpl")
.newInstance();
.getDeclaredConstructor().newInstance();
} catch (ReflectiveOperationException e) {
ReflectionUtils.handleReflectionException(e);
}

3
spring-data-relational/src/main/java/org/springframework/data/relational/core/conversion/BasicRelationalConverter.java

@ -38,7 +38,6 @@ import org.springframework.data.mapping.model.ParameterValueProvider; @@ -38,7 +38,6 @@ import org.springframework.data.mapping.model.ParameterValueProvider;
import org.springframework.data.mapping.model.SimpleTypeHolder;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
@ -162,7 +161,7 @@ public class BasicRelationalConverter implements RelationalConverter { @@ -162,7 +161,7 @@ public class BasicRelationalConverter implements RelationalConverter {
if (getConversions().isSimpleType(value.getClass())) {
if (ClassTypeInformation.OBJECT != type) {
if (TypeInformation.OBJECT != type) {
if (conversionService.canConvert(value.getClass(), type.getType())) {
value = conversionService.convert(value, type.getType());

11
spring-data-relational/src/test/java/org/springframework/data/relational/core/conversion/BasicRelationalConverterUnitTests.java

@ -33,7 +33,6 @@ import org.springframework.data.mapping.PersistentPropertyAccessor; @@ -33,7 +33,6 @@ import org.springframework.data.mapping.PersistentPropertyAccessor;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
/**
@ -78,7 +77,7 @@ class BasicRelationalConverterUnitTests { @@ -78,7 +77,7 @@ class BasicRelationalConverterUnitTests {
@Test // DATAJDBC-235
void shouldConvertEnumToString() {
Object result = converter.writeValue(MyEnum.ON, ClassTypeInformation.from(String.class));
Object result = converter.writeValue(MyEnum.ON, TypeInformation.of(String.class));
assertThat(result).isEqualTo("ON");
}
@ -86,7 +85,7 @@ class BasicRelationalConverterUnitTests { @@ -86,7 +85,7 @@ class BasicRelationalConverterUnitTests {
@Test // DATAJDBC-235
void shouldConvertStringToEnum() {
Object result = converter.readValue("OFF", ClassTypeInformation.from(MyEnum.class));
Object result = converter.readValue("OFF", TypeInformation.of(MyEnum.class));
assertThat(result).isEqualTo(MyEnum.OFF);
}
@ -94,7 +93,7 @@ class BasicRelationalConverterUnitTests { @@ -94,7 +93,7 @@ class BasicRelationalConverterUnitTests {
@Test // GH-1046
void shouldConvertArrayElementsToTargetElementType() throws NoSuchMethodException {
TypeInformation<Object> typeInformation = ClassTypeInformation
TypeInformation<?> typeInformation = TypeInformation
.fromReturnTypeOf(EntityWithArray.class.getMethod("getFloats"));
Double[] value = { 1.2d, 1.3d, 1.4d };
Object result = converter.readValue(value, typeInformation);
@ -116,7 +115,7 @@ class BasicRelationalConverterUnitTests { @@ -116,7 +115,7 @@ class BasicRelationalConverterUnitTests {
@Test // DATAJDBC-516
void shouldConsiderWriteConverter() {
Object result = converter.writeValue(new MyValue("hello-world"), ClassTypeInformation.from(MyValue.class));
Object result = converter.writeValue(new MyValue("hello-world"), TypeInformation.of(MyValue.class));
assertThat(result).isEqualTo("hello-world");
}
@ -124,7 +123,7 @@ class BasicRelationalConverterUnitTests { @@ -124,7 +123,7 @@ class BasicRelationalConverterUnitTests {
@Test // DATAJDBC-516
void shouldConsiderReadConverter() {
Object result = converter.readValue("hello-world", ClassTypeInformation.from(MyValue.class));
Object result = converter.readValue("hello-world", TypeInformation.of(MyValue.class));
assertThat(result).isEqualTo(new MyValue("hello-world"));
}

Loading…
Cancel
Save