diff --git a/springboot-app/src/main/java/io/containerapps/javaruntime/workshop/springboot/SpringbootApplication.java b/springboot-app/src/main/java/io/containerapps/javaruntime/workshop/springboot/SpringbootApplication.java index 33ee8c5..86e8da2 100644 --- a/springboot-app/src/main/java/io/containerapps/javaruntime/workshop/springboot/SpringbootApplication.java +++ b/springboot-app/src/main/java/io/containerapps/javaruntime/workshop/springboot/SpringbootApplication.java @@ -1,13 +1,28 @@ package io.containerapps.javaruntime.workshop.springboot; +import org.springframework.aot.hint.ExecutableMode; +import org.springframework.aot.hint.MemberCategory; +import org.springframework.aot.hint.RuntimeHints; +import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ImportRuntimeHints; @SpringBootApplication +@ImportRuntimeHints(SpringbootApplication.MyRuntimeHints.class) public class SpringbootApplication { - public static void main(String[] args) { - SpringApplication.run(SpringbootApplication.class, args); - } + public static void main(String[] args) { + SpringApplication.run(SpringbootApplication.class, args); + } + static class MyRuntimeHints implements RuntimeHintsRegistrar { + + @Override + public void registerHints(RuntimeHints hints, ClassLoader classLoader) { + hints.reflection() + .registerType(org.hibernate.dialect.PostgreSQLDialect.class, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS); + } + + } } diff --git a/springboot-app/src/main/java/io/containerapps/javaruntime/workshop/springboot/Statistics.java b/springboot-app/src/main/java/io/containerapps/javaruntime/workshop/springboot/Statistics.java index 6d3e069..4269ae6 100644 --- a/springboot-app/src/main/java/io/containerapps/javaruntime/workshop/springboot/Statistics.java +++ b/springboot-app/src/main/java/io/containerapps/javaruntime/workshop/springboot/Statistics.java @@ -3,6 +3,7 @@ package io.containerapps.javaruntime.workshop.springboot; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; + import java.time.Duration; import java.time.Instant; diff --git a/springboot-app/src/main/resources/application.properties b/springboot-app/src/main/resources/application.properties index 8e6b36b..9cfc803 100644 --- a/springboot-app/src/main/resources/application.properties +++ b/springboot-app/src/main/resources/application.properties @@ -6,7 +6,8 @@ spring.jpa.show-sql=true ## Hibernate Properties # The SQL dialect makes Hibernate generate better SQL for the chosen database -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +spring.jpa.open-in-view=false # Hibernate ddl auto (create, create-drop, validate, update) spring.jpa.hibernate.ddl-auto=create-drop