Skip to content

Commit 5108d19

Browse files
committed
Uses DeferredLogFactory in ConfigData constructors
1 parent 9944ee5 commit 5108d19

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

spring-cloud-zookeeper-config/src/main/java/org/springframework/cloud/zookeeper/config/ZookeeperConfigDataLoader.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
import org.springframework.boot.context.config.ConfigDataLoader;
2828
import org.springframework.boot.context.config.ConfigDataLoaderContext;
2929
import org.springframework.boot.context.config.ConfigDataResourceNotFoundException;
30+
import org.springframework.boot.logging.DeferredLogFactory;
3031
import org.springframework.util.StringUtils;
3132

3233
public class ZookeeperConfigDataLoader implements ConfigDataLoader<ZookeeperConfigDataResource> {
3334

3435
private final Log log;
3536

36-
public ZookeeperConfigDataLoader(Log log) {
37-
this.log = log;
37+
public ZookeeperConfigDataLoader(DeferredLogFactory logFactory) {
38+
this.log = logFactory.getLog(ZookeeperConfigDataLoader.class);
3839
}
3940

4041
@Override

spring-cloud-zookeeper-config/src/main/java/org/springframework/cloud/zookeeper/config/ZookeeperConfigDataLocationResolver.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.springframework.boot.context.properties.bind.BindHandler;
3535
import org.springframework.boot.context.properties.bind.Bindable;
3636
import org.springframework.boot.context.properties.bind.Binder;
37+
import org.springframework.boot.logging.DeferredLogFactory;
3738
import org.springframework.cloud.zookeeper.CuratorFactory;
3839
import org.springframework.cloud.zookeeper.ZookeeperProperties;
3940
import org.springframework.cloud.zookeeper.config.ZookeeperPropertySources.Context;
@@ -53,8 +54,8 @@ public class ZookeeperConfigDataLocationResolver implements ConfigDataLocationRe
5354

5455
private final Log log;
5556

56-
public ZookeeperConfigDataLocationResolver(Log log) {
57-
this.log = log;
57+
public ZookeeperConfigDataLocationResolver(DeferredLogFactory logFactory) {
58+
this.log = logFactory.getLog(ZookeeperConfigDataLocationResolver.class);
5859
}
5960

6061
@Override

spring-cloud-zookeeper-config/src/test/java/org/springframework/cloud/zookeeper/config/ZookeeperConfigDataLocationResolverTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class ZookeeperConfigDataLocationResolverTests {
3939

4040
@Test
4141
public void testParseLocation() {
42-
ZookeeperConfigDataLocationResolver resolver = new ZookeeperConfigDataLocationResolver(LogFactory.getLog(getClass()));
42+
ZookeeperConfigDataLocationResolver resolver = new ZookeeperConfigDataLocationResolver(destination -> LogFactory.getLog(ZookeeperConfigDataLocationResolver.class));
4343
UriComponents uriComponents = resolver.parseLocation(
4444
ConfigDataLocation.of("zookeeper:myhost:2182/mypath1;/mypath2;/mypath3"));
4545
assertThat(uriComponents.toUri()).hasScheme("zookeeper").hasHost("myhost")
@@ -94,7 +94,7 @@ private List<ZookeeperConfigDataResource> testResolveProfileSpecific(String loca
9494
}
9595

9696
private ZookeeperConfigDataLocationResolver createResolver() {
97-
return new ZookeeperConfigDataLocationResolver(LogFactory.getLog(getClass()));
97+
return new ZookeeperConfigDataLocationResolver(destination -> LogFactory.getLog(ZookeeperConfigDataLocationResolver.class));
9898
}
9999

100100
}

0 commit comments

Comments
 (0)