Skip to content

Commit

Permalink
Removes @Autowired from fields
Browse files Browse the repository at this point in the history
  • Loading branch information
spencergibb committed Jun 25, 2020
1 parent b153f63 commit 4bbb4ca
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.commons.logging.LogFactory;

import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
Expand Down Expand Up @@ -71,20 +70,24 @@ public ConfigServerInstanceProvider configServerInstanceProvider(
}

@Bean
public SmartApplicationListener heartbeatListener(
public SmartApplicationListener heartbeatListener(ConfigClientProperties properties,
ConfigServerInstanceProvider provider) {
return new HeartbeatListener();
return new HeartbeatListener(properties, provider);
}

private static class HeartbeatListener implements SmartApplicationListener {
private final static class HeartbeatListener implements SmartApplicationListener {

@Autowired
private ConfigClientProperties config;
private final ConfigClientProperties config;

@Autowired
private ConfigServerInstanceProvider instanceProvider;
private final ConfigServerInstanceProvider instanceProvider;

private HeartbeatMonitor monitor = new HeartbeatMonitor();
private final HeartbeatMonitor monitor = new HeartbeatMonitor();

private HeartbeatListener(ConfigClientProperties config,
ConfigServerInstanceProvider instanceProvider) {
this.config = config;
this.instanceProvider = instanceProvider;
}

@Override
public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) {
Expand Down

0 comments on commit 4bbb4ca

Please sign in to comment.