Skip to content

Commit 30f7e82

Browse files
committed
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
1 parent d25dcdb commit 30f7e82

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/aot/R2dbcRuntimeHints.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.springframework.aot.hint.RuntimeHints;
2222
import org.springframework.aot.hint.RuntimeHintsRegistrar;
2323
import org.springframework.aot.hint.TypeReference;
24+
import org.springframework.data.r2dbc.dialect.PostgresDialect;
2425
import org.springframework.data.r2dbc.mapping.event.AfterConvertCallback;
2526
import org.springframework.data.r2dbc.mapping.event.AfterSaveCallback;
2627
import org.springframework.data.r2dbc.mapping.event.BeforeConvertCallback;
@@ -31,6 +32,7 @@
3132
* {@link RuntimeHintsRegistrar} for R2DBC.
3233
*
3334
* @author Christoph Strobl
35+
* @author Mark Paluch
3436
* @since 3.0
3537
*/
3638
class R2dbcRuntimeHints implements RuntimeHintsRegistrar {
@@ -45,5 +47,9 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
4547
.of(BeforeConvertCallback.class),
4648
TypeReference.of(BeforeSaveCallback.class), TypeReference.of(AfterSaveCallback.class)),
4749
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS));
50+
51+
for (Class<?> simpleType : PostgresDialect.INSTANCE.simpleTypes()) {
52+
hints.reflection().registerType(TypeReference.of(simpleType), MemberCategory.PUBLIC_CLASSES);
53+
}
4854
}
4955
}

spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/dialect/PostgresDialect.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,7 @@ public class PostgresDialect extends org.springframework.data.relational.core.di
5959
.forEach(s -> ifClassPresent(s, simpleTypes::add));
6060

6161
// support the native JTS types supported by r2dbc-postgresql
62-
Stream.of("org.locationtech.jts.geom.Geometry", //
63-
"org.locationtech.jts.geom.Point", //
64-
"org.locationtech.jts.geom.MultiPoint", //
65-
"org.locationtech.jts.geom.LineString", //
66-
"org.locationtech.jts.geom.LinearRing", //
67-
"org.locationtech.jts.geom.MultiLineString", //
68-
"org.locationtech.jts.geom.Polygon", //
69-
"org.locationtech.jts.geom.MultiPolygon", //
70-
"org.locationtech.jts.geom.GeometryCollection") //
71-
.forEach(s -> ifClassPresent(s, simpleTypes::add));
62+
ifClassPresent("org.locationtech.jts.geom.Geometry", simpleTypes::add);
7263

7364
// conditional Postgres JSON support.
7465
ifClassPresent("io.r2dbc.postgresql.codec.Json", simpleTypes::add);

0 commit comments

Comments
 (0)