Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
import io.kubernetes.client.openapi.models.V1EndpointAddress;
import io.kubernetes.client.openapi.models.V1Endpoints;
import io.kubernetes.client.openapi.models.V1Service;
import jakarta.annotation.PostConstruct;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.kubernetes.commons.discovery.DefaultKubernetesServiceInstance;
Expand All @@ -55,7 +55,7 @@
* @author Ryan Baxter
* @author Tim Yysewyn
*/
public class KubernetesInformerDiscoveryClient implements DiscoveryClient, InitializingBean {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to continue cleaning up some classes via small PRs, so that they are easy to review. This one does the obvious thing of replacing InitializingBean with @PostConstruct

public class KubernetesInformerDiscoveryClient implements DiscoveryClient {

private static final Log log = LogFactory.getLog(KubernetesInformerDiscoveryClient.class);

Expand Down Expand Up @@ -233,8 +233,8 @@ public List<String> getServices() {
.collect(Collectors.toList());
}

@Override
public void afterPropertiesSet() throws Exception {
@PostConstruct
public void afterPropertiesSet() {
this.sharedInformerFactory.startAllRegisteredInformers();
if (!Wait.poll(Duration.ofSeconds(1), Duration.ofSeconds(this.properties.cacheLoadingTimeoutSeconds()), () -> {
log.info("Waiting for the cache of informers to be fully loaded..");
Expand Down