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; ...@@ -58,7 +58,7 @@ import org.springframework.core.annotation.Order;
@Configuration @Configuration
@ConditionalOnBean(AdminServerMarkerConfiguration.Marker.class) @ConditionalOnBean(AdminServerMarkerConfiguration.Marker.class)
@EnableConfigurationProperties(AdminServerProperties.class) @EnableConfigurationProperties(AdminServerProperties.class)
@Import({AdminServerWebConfiguration.class, AdminServerNotifierConfiguration.class}) @Import({AdminServerWebConfiguration.class})
public class AdminServerAutoConfiguration { public class AdminServerAutoConfiguration {
private final AdminServerProperties adminServerProperties; private final AdminServerProperties adminServerProperties;
......
...@@ -50,7 +50,8 @@ import org.springframework.context.annotation.Primary; ...@@ -50,7 +50,8 @@ import org.springframework.context.annotation.Primary;
import org.springframework.mail.MailSender; import org.springframework.mail.MailSender;
@Configuration @Configuration
public class AdminServerNotifierConfiguration { @AutoConfigureAfter({MailSenderAutoConfiguration.class})
public class AdminServerNotifierAutoConfiguration {
@Configuration @Configuration
@ConditionalOnBean(Notifier.class) @ConditionalOnBean(Notifier.class)
...@@ -97,12 +98,12 @@ public class AdminServerNotifierConfiguration { ...@@ -97,12 +98,12 @@ public class AdminServerNotifierConfiguration {
public NotificationFilterController notificationFilterController() { public NotificationFilterController notificationFilterController() {
return new NotificationFilterController(filteringNotifier); return new NotificationFilterController(filteringNotifier);
} }
} }
@Configuration @Configuration
@ConditionalOnBean(MailSender.class)
@AutoConfigureAfter({MailSenderAutoConfiguration.class})
@AutoConfigureBefore({NotifierTriggerConfiguration.class, CompositeNotifierConfiguration.class}) @AutoConfigureBefore({NotifierTriggerConfiguration.class, CompositeNotifierConfiguration.class})
@ConditionalOnBean(MailSender.class)
public static class MailNotifierConfiguration { public static class MailNotifierConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
......
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration,\ 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.AdminServerDiscoveryAutoConfiguration,\
de.codecentric.boot.admin.server.config.AdminServerHazelcastAutoConfiguration,\ de.codecentric.boot.admin.server.config.AdminServerHazelcastAutoConfiguration,\
de.codecentric.boot.admin.server.config.AdminServerCloudFoundryAutoConfiguration de.codecentric.boot.admin.server.config.AdminServerCloudFoundryAutoConfiguration
...@@ -49,7 +49,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl; ...@@ -49,7 +49,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
import static org.assertj.core.api.Assertions.assertThat; 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, private static final InstanceEvent APP_DOWN = new InstanceStatusChangedEvent(InstanceId.of("id-2"), 0L,
StatusInfo.ofDown()); StatusInfo.ofDown());
...@@ -152,6 +152,7 @@ public class AdminServerNotifierConfigurationTest { ...@@ -152,6 +152,7 @@ public class AdminServerNotifierConfigurationTest {
context.register(RestTemplateAutoConfiguration.class); context.register(RestTemplateAutoConfiguration.class);
context.register(AdminServerMarkerConfiguration.class); context.register(AdminServerMarkerConfiguration.class);
context.register(AdminServerAutoConfiguration.class); context.register(AdminServerAutoConfiguration.class);
context.register(AdminServerNotifierAutoConfiguration.class);
TestPropertyValues.of(environment).applyTo(context); TestPropertyValues.of(environment).applyTo(context);
context.refresh(); 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