From 28fcdf1f1e7c46f3b0639b705b01ac55b0220989 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Sat, 26 Aug 2023 16:38:40 +0200 Subject: [PATCH] GH-280 - Make MomentsProperties usable on AOT. Introduce a default constructor to prevent the AOT engine from breaking as reported in [0]. [0] https://github.com/spring-projects/spring-framework/issues/31117 --- .../modulith/moments/support/MomentsProperties.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/spring-modulith-moments/src/main/java/org/springframework/modulith/moments/support/MomentsProperties.java b/spring-modulith-moments/src/main/java/org/springframework/modulith/moments/support/MomentsProperties.java index fd325d55b..e66af62f9 100644 --- a/spring-modulith-moments/src/main/java/org/springframework/modulith/moments/support/MomentsProperties.java +++ b/spring-modulith-moments/src/main/java/org/springframework/modulith/moments/support/MomentsProperties.java @@ -39,7 +39,7 @@ @ConfigurationProperties(prefix = "spring.modulith.moments") public class MomentsProperties { - public static final MomentsProperties DEFAULTS = new MomentsProperties(null, null, null, (Month) null, false); + public static final MomentsProperties DEFAULTS = new MomentsProperties(); private final Granularity granularity; private final ZoneId zoneId; @@ -49,13 +49,22 @@ public class MomentsProperties { private final ShiftedQuarters quarters; + /** + * Creates a new {@link MomentsProperties} with default granularity of {@value Granularity#HOURS}, a {@link ZoneId} of + * {@code UTC}, the JVM's default {@link Locale} to determine starts of weeks, an unshifted {@link ShiftedQuarter} and + * not enabling the {@link TimeMachine}. + */ + private MomentsProperties() { + this(null, null, null, (Month) null, false); + } + /** * Creates a new {@link MomentsProperties} for the given {@link Granularity}, {@link ZoneId}, {@link Locale} and * quarter start {@link Month}. * * @param granularity can be {@literal null}, defaults to {@value Granularity#HOURS}. * @param zoneId the time zone id to use, defaults to {@code UTC}. - * @param locale + * @param locale the locale to determine starts of weeks. * @param quarterStartMonth the {@link Month} at which quarters start. Defaults to {@value Month#JANUARY}, resulting * in {@link ShiftedQuarter}s without any shift. */