Commit 403b3258 by Johannes Edmeier

Fix wrong autoconfig order preventing mailNotifier to be instantiated

parent 976619f4
......@@ -58,7 +58,7 @@ import org.springframework.core.annotation.Order;
@Configuration
@ConditionalOnBean(AdminServerMarkerConfiguration.Marker.class)
@EnableConfigurationProperties(AdminServerProperties.class)
@Import({AdminServerWebConfiguration.class, AdminServerNotifierConfiguration.class})
@Import({AdminServerWebConfiguration.class})
public class AdminServerAutoConfiguration {
private final AdminServerProperties adminServerProperties;
......
......@@ -50,7 +50,8 @@ import org.springframework.context.annotation.Primary;
import org.springframework.mail.MailSender;
@Configuration
public class AdminServerNotifierConfiguration {
@AutoConfigureAfter({MailSenderAutoConfiguration.class})
public class AdminServerNotifierAutoConfiguration {
@Configuration
@ConditionalOnBean(Notifier.class)
......@@ -97,12 +98,12 @@ public class AdminServerNotifierConfiguration {
public NotificationFilterController notificationFilterController() {
return new NotificationFilterController(filteringNotifier);
}
}
@Configuration
@ConditionalOnBean(MailSender.class)
@AutoConfigureAfter({MailSenderAutoConfiguration.class})
@AutoConfigureBefore({NotifierTriggerConfiguration.class, CompositeNotifierConfiguration.class})
@ConditionalOnBean(MailSender.class)
public static class MailNotifierConfiguration {
@Bean
@ConditionalOnMissingBean
......
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration,\
de.codecentric.boot.admin.server.config.AdminServerNotifierAutoConfiguration,\
de.codecentric.boot.admin.server.config.AdminServerDiscoveryAutoConfiguration,\
de.codecentric.boot.admin.server.config.AdminServerHazelcastAutoConfiguration,\
de.codecentric.boot.admin.server.config.AdminServerCloudFoundryAutoConfiguration
......@@ -49,7 +49,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
import static org.assertj.core.api.Assertions.assertThat;
public class AdminServerNotifierConfigurationTest {
public class AdminServerNotifierAutoConfigurationTest {
private static final InstanceEvent APP_DOWN = new InstanceStatusChangedEvent(InstanceId.of("id-2"), 0L,
StatusInfo.ofDown());
......@@ -152,6 +152,7 @@ public class AdminServerNotifierConfigurationTest {
context.register(RestTemplateAutoConfiguration.class);
context.register(AdminServerMarkerConfiguration.class);
context.register(AdminServerAutoConfiguration.class);
context.register(AdminServerNotifierAutoConfiguration.class);
TestPropertyValues.of(environment).applyTo(context);
context.refresh();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment