Skip to content

Commit 28fcdf1

Browse files
committed
GH-280 - Make MomentsProperties usable on AOT.
Introduce a default constructor to prevent the AOT engine from breaking as reported in [0]. [0] spring-projects/spring-framework#31117
1 parent 4d939d3 commit 28fcdf1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

spring-modulith-moments/src/main/java/org/springframework/modulith/moments/support/MomentsProperties.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
@ConfigurationProperties(prefix = "spring.modulith.moments")
4040
public class MomentsProperties {
4141

42-
public static final MomentsProperties DEFAULTS = new MomentsProperties(null, null, null, (Month) null, false);
42+
public static final MomentsProperties DEFAULTS = new MomentsProperties();
4343

4444
private final Granularity granularity;
4545
private final ZoneId zoneId;
@@ -49,13 +49,22 @@ public class MomentsProperties {
4949

5050
private final ShiftedQuarters quarters;
5151

52+
/**
53+
* Creates a new {@link MomentsProperties} with default granularity of {@value Granularity#HOURS}, a {@link ZoneId} of
54+
* {@code UTC}, the JVM's default {@link Locale} to determine starts of weeks, an unshifted {@link ShiftedQuarter} and
55+
* not enabling the {@link TimeMachine}.
56+
*/
57+
private MomentsProperties() {
58+
this(null, null, null, (Month) null, false);
59+
}
60+
5261
/**
5362
* Creates a new {@link MomentsProperties} for the given {@link Granularity}, {@link ZoneId}, {@link Locale} and
5463
* quarter start {@link Month}.
5564
*
5665
* @param granularity can be {@literal null}, defaults to {@value Granularity#HOURS}.
5766
* @param zoneId the time zone id to use, defaults to {@code UTC}.
58-
* @param locale
67+
* @param locale the locale to determine starts of weeks.
5968
* @param quarterStartMonth the {@link Month} at which quarters start. Defaults to {@value Month#JANUARY}, resulting
6069
* in {@link ShiftedQuarter}s without any shift.
6170
*/

0 commit comments

Comments
 (0)