Uses DeferredLogFactory in ConfigData constructors
This commit is contained in:
@@ -27,14 +27,15 @@ import org.springframework.boot.context.config.ConfigData;
|
||||
import org.springframework.boot.context.config.ConfigDataLoader;
|
||||
import org.springframework.boot.context.config.ConfigDataLoaderContext;
|
||||
import org.springframework.boot.context.config.ConfigDataResourceNotFoundException;
|
||||
import org.springframework.boot.logging.DeferredLogFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
public class ZookeeperConfigDataLoader implements ConfigDataLoader<ZookeeperConfigDataResource> {
|
||||
|
||||
private final Log log;
|
||||
|
||||
public ZookeeperConfigDataLoader(Log log) {
|
||||
this.log = log;
|
||||
public ZookeeperConfigDataLoader(DeferredLogFactory logFactory) {
|
||||
this.log = logFactory.getLog(ZookeeperConfigDataLoader.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.boot.context.config.Profiles;
|
||||
import org.springframework.boot.context.properties.bind.BindHandler;
|
||||
import org.springframework.boot.context.properties.bind.Bindable;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.boot.logging.DeferredLogFactory;
|
||||
import org.springframework.cloud.zookeeper.CuratorFactory;
|
||||
import org.springframework.cloud.zookeeper.ZookeeperProperties;
|
||||
import org.springframework.cloud.zookeeper.config.ZookeeperPropertySources.Context;
|
||||
@@ -53,8 +54,8 @@ public class ZookeeperConfigDataLocationResolver implements ConfigDataLocationRe
|
||||
|
||||
private final Log log;
|
||||
|
||||
public ZookeeperConfigDataLocationResolver(Log log) {
|
||||
this.log = log;
|
||||
public ZookeeperConfigDataLocationResolver(DeferredLogFactory logFactory) {
|
||||
this.log = logFactory.getLog(ZookeeperConfigDataLocationResolver.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ZookeeperConfigDataLocationResolverTests {
|
||||
|
||||
@Test
|
||||
public void testParseLocation() {
|
||||
ZookeeperConfigDataLocationResolver resolver = new ZookeeperConfigDataLocationResolver(LogFactory.getLog(getClass()));
|
||||
ZookeeperConfigDataLocationResolver resolver = new ZookeeperConfigDataLocationResolver(destination -> LogFactory.getLog(ZookeeperConfigDataLocationResolver.class));
|
||||
UriComponents uriComponents = resolver.parseLocation(
|
||||
ConfigDataLocation.of("zookeeper:myhost:2182/mypath1;/mypath2;/mypath3"));
|
||||
assertThat(uriComponents.toUri()).hasScheme("zookeeper").hasHost("myhost")
|
||||
@@ -94,7 +94,7 @@ public class ZookeeperConfigDataLocationResolverTests {
|
||||
}
|
||||
|
||||
private ZookeeperConfigDataLocationResolver createResolver() {
|
||||
return new ZookeeperConfigDataLocationResolver(LogFactory.getLog(getClass()));
|
||||
return new ZookeeperConfigDataLocationResolver(destination -> LogFactory.getLog(ZookeeperConfigDataLocationResolver.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user