Polishing.
Add Geometry super-type only as subtypes are considered simple types already. Ensure reflective simple type AOT registration. Original pull request: #1713 See #1711
This commit is contained in:
@@ -21,6 +21,7 @@ import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.TypeReference;
|
||||
import org.springframework.data.r2dbc.dialect.PostgresDialect;
|
||||
import org.springframework.data.r2dbc.mapping.event.AfterConvertCallback;
|
||||
import org.springframework.data.r2dbc.mapping.event.AfterSaveCallback;
|
||||
import org.springframework.data.r2dbc.mapping.event.BeforeConvertCallback;
|
||||
@@ -31,6 +32,7 @@ import org.springframework.data.r2dbc.repository.support.SimpleR2dbcRepository;
|
||||
* {@link RuntimeHintsRegistrar} for R2DBC.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @since 3.0
|
||||
*/
|
||||
class R2dbcRuntimeHints implements RuntimeHintsRegistrar {
|
||||
@@ -45,5 +47,9 @@ class R2dbcRuntimeHints implements RuntimeHintsRegistrar {
|
||||
.of(BeforeConvertCallback.class),
|
||||
TypeReference.of(BeforeSaveCallback.class), TypeReference.of(AfterSaveCallback.class)),
|
||||
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS));
|
||||
|
||||
for (Class<?> simpleType : PostgresDialect.INSTANCE.simpleTypes()) {
|
||||
hints.reflection().registerType(TypeReference.of(simpleType), MemberCategory.PUBLIC_CLASSES);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,16 +59,7 @@ public class PostgresDialect extends org.springframework.data.relational.core.di
|
||||
.forEach(s -> ifClassPresent(s, simpleTypes::add));
|
||||
|
||||
// support the native JTS types supported by r2dbc-postgresql
|
||||
Stream.of("org.locationtech.jts.geom.Geometry", //
|
||||
"org.locationtech.jts.geom.Point", //
|
||||
"org.locationtech.jts.geom.MultiPoint", //
|
||||
"org.locationtech.jts.geom.LineString", //
|
||||
"org.locationtech.jts.geom.LinearRing", //
|
||||
"org.locationtech.jts.geom.MultiLineString", //
|
||||
"org.locationtech.jts.geom.Polygon", //
|
||||
"org.locationtech.jts.geom.MultiPolygon", //
|
||||
"org.locationtech.jts.geom.GeometryCollection") //
|
||||
.forEach(s -> ifClassPresent(s, simpleTypes::add));
|
||||
ifClassPresent("org.locationtech.jts.geom.Geometry", simpleTypes::add);
|
||||
|
||||
// conditional Postgres JSON support.
|
||||
ifClassPresent("io.r2dbc.postgresql.codec.Json", simpleTypes::add);
|
||||
|
||||
Reference in New Issue
Block a user