GH-8 - Rename configuration properties for the Moments module.
moduliths.moments -> spring.modulith.moments
This commit is contained in:
@@ -35,12 +35,13 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
*/
|
||||
@EnableScheduling
|
||||
@EnableConfigurationProperties(MomentsProperties.class)
|
||||
@ConditionalOnProperty(name = "moduliths.moments.enabled", havingValue = "true", matchIfMissing = true)
|
||||
@ConditionalOnProperty(name = "spring.modulith.moments.enabled", havingValue = "true", matchIfMissing = true)
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class MomentsAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "moduliths.moments.enable-time-machine", havingValue = "false", matchIfMissing = true)
|
||||
@ConditionalOnProperty(name = "spring.modulith.moments.enable-time-machine", havingValue = "false",
|
||||
matchIfMissing = true)
|
||||
Moments moments(ObjectProvider<Clock> clockProvider, ApplicationEventPublisher events, MomentsProperties properties) {
|
||||
|
||||
Clock clock = clockProvider.getIfAvailable(() -> Clock.systemUTC());
|
||||
@@ -49,7 +50,8 @@ class MomentsAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "moduliths.moments.enable-time-machine", havingValue = "true", matchIfMissing = false)
|
||||
@ConditionalOnProperty(name = "spring.modulith.moments.enable-time-machine", havingValue = "true",
|
||||
matchIfMissing = false)
|
||||
TimeMachine timeMachine(ObjectProvider<Clock> clockProvider, ApplicationEventPublisher events,
|
||||
MomentsProperties properties) {
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "moduliths.moments")
|
||||
@ConfigurationProperties(prefix = "spring.modulith.moments")
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class MomentsProperties {
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class MomentsAutoConfigurationTests {
|
||||
|
||||
new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(MomentsAutoConfiguration.class))
|
||||
.withPropertyValues("moduliths.moments.zone-id:Europe/Berlin")
|
||||
.withPropertyValues("spring.modulith.moments.zone-id:Europe/Berlin")
|
||||
.run(it -> {
|
||||
assertThat(it).getBean(MomentsProperties.class)
|
||||
.extracting(MomentsProperties::getZoneId)
|
||||
@@ -64,7 +64,7 @@ class MomentsAutoConfigurationTests {
|
||||
|
||||
new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(MomentsAutoConfiguration.class))
|
||||
.withPropertyValues("moduliths.moments.quarter-start-month=February")
|
||||
.withPropertyValues("spring.modulith.moments.quarter-start-month=February")
|
||||
.run(it -> {
|
||||
assertThat(it).getBean(MomentsProperties.class).satisfies(props -> {
|
||||
assertThat(props.getShiftedQuarter(LocalDate.of(2022, 1, 1)).getQuarter()).isEqualTo(Quarter.Q4);
|
||||
@@ -77,7 +77,7 @@ class MomentsAutoConfigurationTests {
|
||||
|
||||
new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(MomentsAutoConfiguration.class))
|
||||
.withPropertyValues("moduliths.moments.enabled=false")
|
||||
.withPropertyValues("spring.modulith.moments.enabled=false")
|
||||
.run(it -> {
|
||||
assertThat(it).doesNotHaveBean(Moments.class);
|
||||
assertThat(it).doesNotHaveBean(MomentsProperties.class);
|
||||
@@ -89,7 +89,7 @@ class MomentsAutoConfigurationTests {
|
||||
|
||||
new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(MomentsAutoConfiguration.class))
|
||||
.withPropertyValues("moduliths.moments.enable-time-machine=true")
|
||||
.withPropertyValues("spring.modulith.moments.enable-time-machine=true")
|
||||
.run(it -> {
|
||||
assertThat(it).hasSingleBean(TimeMachine.class);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user