Commit 273beaa3 authored by Phillip Webb's avatar Phillip Webb

Polish

parent f8acaae1
...@@ -41,9 +41,9 @@ public class CacheManagerCustomizers { ...@@ -41,9 +41,9 @@ public class CacheManagerCustomizers {
public CacheManagerCustomizers( public CacheManagerCustomizers(
List<? extends CacheManagerCustomizer<?>> customizers) { List<? extends CacheManagerCustomizer<?>> customizers) {
this.customizers = (customizers != null ? this.customizers = (customizers != null
new ArrayList<CacheManagerCustomizer<?>>(customizers) : ? new ArrayList<CacheManagerCustomizer<?>>(customizers)
Collections.<CacheManagerCustomizer<?>>emptyList()); : Collections.<CacheManagerCustomizer<?>>emptyList());
} }
/** /**
...@@ -57,8 +57,7 @@ public class CacheManagerCustomizers { ...@@ -57,8 +57,7 @@ public class CacheManagerCustomizers {
public <T extends CacheManager> T customize(T cacheManager) { public <T extends CacheManager> T customize(T cacheManager) {
for (CacheManagerCustomizer<?> customizer : this.customizers) { for (CacheManagerCustomizer<?> customizer : this.customizers) {
Class<?> generic = ResolvableType Class<?> generic = ResolvableType
.forClass(CacheManagerCustomizer.class, .forClass(CacheManagerCustomizer.class, customizer.getClass())
customizer.getClass())
.resolveGeneric(); .resolveGeneric();
if (generic.isInstance(cacheManager)) { if (generic.isInstance(cacheManager)) {
customize(cacheManager, customizer); customize(cacheManager, customizer);
......
...@@ -37,8 +37,7 @@ public class CacheManagerCustomizersTests { ...@@ -37,8 +37,7 @@ public class CacheManagerCustomizersTests {
@Test @Test
public void customizeWithNullCustomizersShouldDoNothing() { public void customizeWithNullCustomizersShouldDoNothing() {
new CacheManagerCustomizers(null) new CacheManagerCustomizers(null).customize(mock(CacheManager.class));
.customize(mock(CacheManager.class));
} }
@Test @Test
......
...@@ -46,7 +46,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -46,7 +46,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@AutoConfigureMockMvc @AutoConfigureMockMvc
public class SampleActuatorLog4J2ApplicationTests { public class SampleActuatorLog4J2ApplicationTests {
private static final Logger logger = LogManager.getLogger(SampleActuatorLog4J2ApplicationTests.class); private static final Logger logger = LogManager
.getLogger(SampleActuatorLog4J2ApplicationTests.class);
@Rule @Rule
public OutputCapture output = new OutputCapture(); public OutputCapture output = new OutputCapture();
...@@ -64,8 +65,8 @@ public class SampleActuatorLog4J2ApplicationTests { ...@@ -64,8 +65,8 @@ public class SampleActuatorLog4J2ApplicationTests {
public void validateLoggersEndpoint() throws Exception { public void validateLoggersEndpoint() throws Exception {
this.mvc.perform(get("/loggers/org.apache.coyote.http11.Http11NioProtocol")) this.mvc.perform(get("/loggers/org.apache.coyote.http11.Http11NioProtocol"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().string(equalTo( .andExpect(content().string(equalTo("{\"configuredLevel\":\"WARN\","
"{\"configuredLevel\":\"WARN\"," + "\"effectiveLevel\":\"WARN\"}"))); + "\"effectiveLevel\":\"WARN\"}")));
} }
} }
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<main.basedir>${basedir}/../..</main.basedir> <main.basedir>${basedir}/../..</main.basedir>
</properties> </properties>
<dependencies> <dependencies>
<!-- Compile -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
...@@ -27,13 +28,13 @@ ...@@ -27,13 +28,13 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-remote-shell</artifactId> <artifactId>spring-boot-starter-remote-shell</artifactId>
</dependency> </dependency>
<!-- Optional -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId> <artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Test -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<main.basedir>${basedir}/../..</main.basedir> <main.basedir>${basedir}/../..</main.basedir>
</properties> </properties>
<dependencies> <dependencies>
<!-- Compile -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
...@@ -39,38 +40,24 @@ ...@@ -39,38 +40,24 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-remote-shell</artifactId> <artifactId>spring-boot-starter-remote-shell</artifactId>
</dependency> </dependency>
<!-- Runtime -->
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<!-- Optional -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId> <artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Test -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- <dependency>
<groupId>org.crashub</groupId>
<artifactId>crash.connectors.telnet</artifactId>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency> -->
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
...@@ -31,10 +31,12 @@ public class SampleFlywayApplication { ...@@ -31,10 +31,12 @@ public class SampleFlywayApplication {
@Bean @Bean
public CommandLineRunner runner(final PersonRepository repository) { public CommandLineRunner runner(final PersonRepository repository) {
return new CommandLineRunner() { return new CommandLineRunner() {
@Override @Override
public void run(String... args) throws Exception { public void run(String... args) throws Exception {
System.err.println(repository.findAll()); System.err.println(repository.findAll());
} }
}; };
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<main.basedir>${basedir}/../..</main.basedir> <main.basedir>${basedir}/../..</main.basedir>
</properties> </properties>
<dependencies> <dependencies>
<!-- Compile -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId> <artifactId>spring-boot-starter-integration</artifactId>
...@@ -27,13 +28,13 @@ ...@@ -27,13 +28,13 @@
<groupId>org.springframework.integration</groupId> <groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-file</artifactId> <artifactId>spring-integration-file</artifactId>
</dependency> </dependency>
<!-- Optional -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId> <artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Test -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
<artifactId>spring-boot-starter-tomcat</artifactId> <artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<!-- Your own application should inherit from spring-boot-starter-parent --> <!-- Your own application should inherit from spring-boot-starter-parent -->
...@@ -19,6 +20,7 @@ ...@@ -19,6 +20,7 @@
<main.basedir>${basedir}/../..</main.basedir> <main.basedir>${basedir}/../..</main.basedir>
</properties> </properties>
<dependencies> <dependencies>
<!-- Compile -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
...@@ -31,13 +33,13 @@ ...@@ -31,13 +33,13 @@
<groupId>io.dropwizard.metrics</groupId> <groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId> <artifactId>metrics-core</artifactId>
</dependency> </dependency>
<!-- Optional -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId> <artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Test -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
......
...@@ -33,7 +33,8 @@ public class SampleController { ...@@ -33,7 +33,8 @@ public class SampleController {
private final GaugeService gauges; private final GaugeService gauges;
public SampleController(HelloWorldProperties helloWorldProperties, GaugeService gauges) { public SampleController(HelloWorldProperties helloWorldProperties,
GaugeService gauges) {
this.helloWorldProperties = helloWorldProperties; this.helloWorldProperties = helloWorldProperties;
this.gauges = gauges; this.gauges = gauges;
} }
...@@ -42,8 +43,8 @@ public class SampleController { ...@@ -42,8 +43,8 @@ public class SampleController {
@ResponseBody @ResponseBody
public Map<String, String> hello() { public Map<String, String> hello() {
this.gauges.submit("timer.test.value", Math.random() * 1000 + 1000); this.gauges.submit("timer.test.value", Math.random() * 1000 + 1000);
return Collections.singletonMap("message", "Hello " + return Collections.singletonMap("message",
this.helloWorldProperties.getName()); "Hello " + this.helloWorldProperties.getName());
} }
} }
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<main.basedir>${basedir}/../..</main.basedir> <main.basedir>${basedir}/../..</main.basedir>
</properties> </properties>
<dependencies> <dependencies>
<!-- Compile -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
...@@ -27,13 +28,13 @@ ...@@ -27,13 +28,13 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<!-- Optional -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId> <artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Test -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<!-- Your own application should inherit from spring-boot-starter-parent --> <!-- Your own application should inherit from spring-boot-starter-parent -->
...@@ -19,6 +20,7 @@ ...@@ -19,6 +20,7 @@
<main.basedir>${basedir}/../..</main.basedir> <main.basedir>${basedir}/../..</main.basedir>
</properties> </properties>
<dependencies> <dependencies>
<!-- Compile -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
...@@ -31,13 +33,13 @@ ...@@ -31,13 +33,13 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> </dependency>
<!-- Optional -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId> <artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Test -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment