Skip to content

Commit c972689

Browse files
committed
Polish
1 parent d301d0f commit c972689

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/LoggersMvcEndpoint.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,19 @@ public Object set(@PathVariable String name,
6868
// disabled
6969
return getDisabledResponse();
7070
}
71-
LogLevel logLevel;
7271
try {
73-
String level = configuration.get("configuredLevel");
74-
logLevel = level == null ? null : LogLevel.valueOf(level.toUpperCase());
72+
LogLevel logLevel = getLogLevel(configuration);
73+
this.delegate.setLogLevel(name, logLevel);
74+
return ResponseEntity.ok().build();
7575
}
7676
catch (IllegalArgumentException ex) {
7777
return ResponseEntity.badRequest().build();
7878
}
79+
}
7980

80-
this.delegate.setLogLevel(name, logLevel);
81-
return ResponseEntity.ok().build();
81+
private LogLevel getLogLevel(Map<String, String> configuration) {
82+
String level = configuration.get("configuredLevel");
83+
return (level == null ? null : LogLevel.valueOf(level.toUpperCase()));
8284
}
8385

8486
}

spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/TraceWebFilterAutoConfigurationTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,24 @@ public void overrideTraceFilter() throws Exception {
6666
public void skipsFilterIfPropertyDisabled() throws Exception {
6767
load("endpoints.trace.filter.enabled:false");
6868
assertThat(this.context.getBeansOfType(WebRequestTraceFilter.class).size())
69-
.isEqualTo(0);
69+
.isEqualTo(0);
7070
}
7171

7272
private void load(String... environment) {
7373
load(null, environment);
7474
}
7575

7676
private void load(Class<?> config, String... environment) {
77-
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
78-
EnvironmentTestUtils.addEnvironment(ctx, environment);
77+
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
78+
EnvironmentTestUtils.addEnvironment(context, environment);
7979
if (config != null) {
80-
ctx.register(config);
80+
context.register(config);
8181
}
82-
ctx.register(PropertyPlaceholderAutoConfiguration.class,
83-
TraceRepositoryAutoConfiguration.class,
84-
TraceWebFilterAutoConfiguration.class);
85-
ctx.refresh();
86-
this.context = ctx;
82+
context.register(PropertyPlaceholderAutoConfiguration.class,
83+
TraceRepositoryAutoConfiguration.class,
84+
TraceWebFilterAutoConfiguration.class);
85+
context.refresh();
86+
this.context = context;
8787
}
8888

8989
@Configuration

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public static MethodValidationPostProcessor methodValidationPostProcessor(
6666
}
6767

6868
private static boolean determineProxyTargetClass(Environment environment) {
69-
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
70-
environment, "spring.aop.");
69+
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
70+
"spring.aop.");
7171
Boolean value = resolver.getProperty("proxyTargetClass", Boolean.class);
7272
return (value != null ? value : true);
7373
}

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/validation/ValidationAutoConfigurationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ public void validationUsesCglibProxy() {
7878

7979
@Test
8080
public void validationCanBeConfiguredToUseJdkProxy() {
81-
load(AnotherSampleServiceConfiguration.class, "spring.aop.proxy-target-class=false");
81+
load(AnotherSampleServiceConfiguration.class,
82+
"spring.aop.proxy-target-class=false");
8283
assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1);
8384
assertThat(this.context.getBeansOfType(DefaultAnotherSampleService.class))
84-
.isEmpty();
85-
AnotherSampleService service = this.context
86-
.getBean(AnotherSampleService.class);
85+
.isEmpty();
86+
AnotherSampleService service = this.context.getBean(AnotherSampleService.class);
8787
service.doSomething(42);
8888
this.thrown.expect(ConstraintViolationException.class);
8989
service.doSomething(2);

0 commit comments

Comments
 (0)