Skip to content

Commit

Permalink
Create ConsulFunction properly to avoid ClassNotFoundException
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjbaxter committed Jun 15, 2023
1 parent a9b4d44 commit 3368779
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void initialize(BootstrapRegistry registry) {
// ConfigServerInstanceProvider.Function
// which would result in a ClassNotFoundException when Spring Cloud Config is not
// on the classpath
registry.registerIfAbsent(ConfigServerInstanceProvider.Function.class, ConsulFunction::new);
registry.registerIfAbsent(ConfigServerInstanceProvider.Function.class, ConsulFunction::create);
}

private BindHandler getBindHandler(org.springframework.boot.BootstrapContext context) {
Expand Down Expand Up @@ -126,6 +126,10 @@ private ConsulFunction(BootstrapContext context) {
this.context = context;
}

public static ConsulFunction create(BootstrapContext context) {
return new ConsulFunction(context);
}

@Override
public List<ServiceInstance> apply(String serviceId) {
return apply(serviceId, null, null, null);
Expand Down

0 comments on commit 3368779

Please sign in to comment.