From 6f12272838f5c350364fab47609dddb302ab009d Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Sun, 15 Jan 2023 13:14:45 -0800 Subject: [PATCH] Add native image support Including a workaround for https://github.com/spring-projects/spring-framework/issues/31050 --- .sdkmanrc | 2 +- dog-service/pom.xml | 4 ++++ .../resources/META-INF/native-image/proxy-config.json | 11 +++++++++++ .../META-INF/native-image/reflect-config.json | 6 ++++++ dog-service/src/main/resources/application.yml | 5 ++++- 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 dog-service/src/main/resources/META-INF/native-image/proxy-config.json create mode 100644 dog-service/src/main/resources/META-INF/native-image/reflect-config.json diff --git a/.sdkmanrc b/.sdkmanrc index da5b078..61fd4b4 100644 --- a/.sdkmanrc +++ b/.sdkmanrc @@ -1 +1 @@ -java=17.0.8-librca +java=23.r20-nik diff --git a/dog-service/pom.xml b/dog-service/pom.xml index 649fd68..09f86a2 100644 --- a/dog-service/pom.xml +++ b/dog-service/pom.xml @@ -56,6 +56,10 @@ org.springframework.boot spring-boot-maven-plugin + + org.graalvm.buildtools + native-maven-plugin + diff --git a/dog-service/src/main/resources/META-INF/native-image/proxy-config.json b/dog-service/src/main/resources/META-INF/native-image/proxy-config.json new file mode 100644 index 0000000..f27b557 --- /dev/null +++ b/dog-service/src/main/resources/META-INF/native-image/proxy-config.json @@ -0,0 +1,11 @@ +[ + { + "interfaces": [ + "org.hibernate.query.hql.spi.SqmQueryImplementor", + "org.hibernate.query.sqm.internal.SqmInterpretationsKey$InterpretationsKeySource", + "org.hibernate.query.spi.DomainQueryExecutionContext", + "org.hibernate.query.SelectionQuery", + "org.hibernate.query.CommonQueryContract" + ] + } +] diff --git a/dog-service/src/main/resources/META-INF/native-image/reflect-config.json b/dog-service/src/main/resources/META-INF/native-image/reflect-config.json new file mode 100644 index 0000000..1de763e --- /dev/null +++ b/dog-service/src/main/resources/META-INF/native-image/reflect-config.json @@ -0,0 +1,6 @@ +[ + { + "name": "org.postgresql.util.PGobject", + "allDeclaredConstructors": true + } +] \ No newline at end of file diff --git a/dog-service/src/main/resources/application.yml b/dog-service/src/main/resources/application.yml index 07b97fe..f4b59cd 100644 --- a/dog-service/src/main/resources/application.yml +++ b/dog-service/src/main/resources/application.yml @@ -8,7 +8,10 @@ spring: jpa: open-in-view: false jmx: - enabled: true + enabled: false + mvc: + problemdetails: + enabled: true sql: init: mode: always