diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/BasicErrorController.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/BasicErrorController.java index ff7f1f80159..99d273e5ebb 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/BasicErrorController.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/BasicErrorController.java @@ -76,16 +76,19 @@ public class BasicErrorController implements ErrorController { String trace = request.getParameter("trace"); Map extracted = extract(attributes, trace != null && !"false".equals(trace.toLowerCase()), true); - HttpStatus statusCode; - try { - statusCode = HttpStatus.valueOf((Integer) extracted.get("status")); - } - catch (Exception e) { - statusCode = HttpStatus.INTERNAL_SERVER_ERROR; - } + HttpStatus statusCode = getStatus((Integer) extracted.get("status")); return new ResponseEntity>(extracted, statusCode); } + private HttpStatus getStatus(Integer value) { + try { + return HttpStatus.valueOf(value); + } + catch (Exception ex) { + return HttpStatus.INTERNAL_SERVER_ERROR; + } + } + @Override public Map extract(RequestAttributes attributes, boolean trace, boolean log) { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java index 05ef2990fa6..f3e33779ba2 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java @@ -32,7 +32,6 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; -import org.springframework.web.client.RestTemplate; import static org.junit.Assert.assertEquals; @@ -61,8 +60,8 @@ public class ManagementPortSampleActuatorApplicationTests { @Test public void testHome() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity entity = getRestTemplate("user", getPassword()).getForEntity( - "http://localhost:" + this.port, Map.class); + ResponseEntity entity = RestTemplates.get("user", getPassword()) + .getForEntity("http://localhost:" + this.port, Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") Map body = entity.getBody(); @@ -73,14 +72,14 @@ public class ManagementPortSampleActuatorApplicationTests { public void testMetrics() throws Exception { testHome(); // makes sure some requests have been made @SuppressWarnings("rawtypes") - ResponseEntity entity = getRestTemplate().getForEntity( + ResponseEntity entity = RestTemplates.get().getForEntity( "http://localhost:" + this.managementPort + "/metrics", Map.class); assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode()); } @Test public void testHealth() throws Exception { - ResponseEntity entity = getRestTemplate().getForEntity( + ResponseEntity entity = RestTemplates.get().getForEntity( "http://localhost:" + this.managementPort + "/health", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals("ok", entity.getBody()); @@ -89,7 +88,7 @@ public class ManagementPortSampleActuatorApplicationTests { @Test public void testErrorPage() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity entity = getRestTemplate().getForEntity( + ResponseEntity entity = RestTemplates.get().getForEntity( "http://localhost:" + this.managementPort + "/error", Map.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); @SuppressWarnings("unchecked") @@ -101,12 +100,4 @@ public class ManagementPortSampleActuatorApplicationTests { return this.security.getUser().getPassword(); } - private RestTemplate getRestTemplate() { - return RestTemplates.get(); - } - - private RestTemplate getRestTemplate(final String username, final String password) { - return RestTemplates.get(username, password); - } - } diff --git a/spring-boot-starters/spring-boot-starter-actuator/pom.xml b/spring-boot-starters/spring-boot-starter-actuator/pom.xml index 209be2f4de7..149cec6bd23 100644 --- a/spring-boot-starters/spring-boot-starter-actuator/pom.xml +++ b/spring-boot-starters/spring-boot-starter-actuator/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 org.springframework.boot diff --git a/spring-boot/src/main/java/org/springframework/boot/Banner.java b/spring-boot/src/main/java/org/springframework/boot/Banner.java index 190c3368c01..881e122e288 100644 --- a/spring-boot/src/main/java/org/springframework/boot/Banner.java +++ b/spring-boot/src/main/java/org/springframework/boot/Banner.java @@ -63,4 +63,5 @@ abstract class Banner { FAINT, version)); printStream.println(); } + } diff --git a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java index bef13950b9f..2b9723aed2f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java @@ -301,10 +301,13 @@ class BeanDefinitionLoader { protected boolean matchClassName(String className) { return this.classNames.contains(className); } + } protected interface GroovyBeanDefinitionSource { + Closure getBeans(); + } } diff --git a/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiElement.java b/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiElement.java index 96d308d21cb..cccb8fcfe86 100644 --- a/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiElement.java +++ b/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiElement.java @@ -24,19 +24,31 @@ package org.springframework.boot.ansi; public interface AnsiElement { public static final AnsiElement NORMAL = new DefaultAnsiElement("0"); + public static final AnsiElement BOLD = new DefaultAnsiElement("1"); + public static final AnsiElement FAINT = new DefaultAnsiElement("2"); + public static final AnsiElement ITALIC = new DefaultAnsiElement("3"); + public static final AnsiElement UNDERLINE = new DefaultAnsiElement("4"); public static final AnsiElement BLACK = new DefaultAnsiElement("30"); + public static final AnsiElement RED = new DefaultAnsiElement("31"); + public static final AnsiElement GREEN = new DefaultAnsiElement("32"); + public static final AnsiElement YELLOW = new DefaultAnsiElement("33"); + public static final AnsiElement BLUE = new DefaultAnsiElement("34"); + public static final AnsiElement MAGENTA = new DefaultAnsiElement("35"); + public static final AnsiElement CYAN = new DefaultAnsiElement("36"); + public static final AnsiElement WHITE = new DefaultAnsiElement("37"); + public static final AnsiElement DEFAULT = new DefaultAnsiElement("39"); /** @@ -60,6 +72,7 @@ public interface AnsiElement { public String toString() { return this.code; } + } } diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java index 0a58c3c3b4f..0da731ef2de 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java @@ -90,6 +90,7 @@ public final class RelaxedNames implements Iterable { }; public abstract String apply(String value); + } static enum Manipulation { @@ -157,5 +158,7 @@ public final class RelaxedNames implements Iterable { }; public abstract String apply(String value); + } + } diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java b/spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java index 5c8f2fc8e0a..7cdfb9d5430 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,5 +89,6 @@ public class YamlJavaBeanPropertyConstructor extends Constructor { Property property = (forType == null ? null : forType.get(name)); return (property == null ? super.getProperty(type, name) : property); } + } } diff --git a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java index 4a4016cb5d8..97a77bcf7b5 100644 --- a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java @@ -75,6 +75,7 @@ public class ParentContextApplicationContextInitializer implements (ConfigurableApplicationContext) context)); } } + } public static class ParentContextAvailableEvent extends ApplicationEvent { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java index 619248f41f3..82029326a46 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java @@ -75,4 +75,5 @@ public class FileEncodingApplicationListener implements } } } + }; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java index 75385ddeab5..9b79f11a917 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java @@ -48,6 +48,7 @@ public interface EmbeddedServletContainer { public int getPort() { return 0; } + }; /** diff --git a/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java b/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java index 61cc860d528..12b774f1a6d 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java @@ -75,4 +75,5 @@ public class EnumerableCompositePropertySource extends getSource().add(source); this.names = null; } + } diff --git a/spring-boot/src/main/java/org/springframework/boot/env/PropertiesPropertySourceLoader.java b/spring-boot/src/main/java/org/springframework/boot/env/PropertiesPropertySourceLoader.java index ec03d11cdb2..6c2f8618b19 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/PropertiesPropertySourceLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/PropertiesPropertySourceLoader.java @@ -48,4 +48,5 @@ public class PropertiesPropertySourceLoader implements PropertySourceLoader { } return null; } + } diff --git a/spring-boot/src/main/java/org/springframework/boot/test/Base64.java b/spring-boot/src/main/java/org/springframework/boot/test/Base64.java index 364e758d976..8f8ec07f8bc 100644 --- a/spring-boot/src/main/java/org/springframework/boot/test/Base64.java +++ b/spring-boot/src/main/java/org/springframework/boot/test/Base64.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -640,4 +640,5 @@ class InvalidBase64CharacterException extends IllegalArgumentException { InvalidBase64CharacterException(String message) { super(message); } + } diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java index 1bb2d99c1db..694f005b679 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java @@ -487,9 +487,11 @@ public class RelaxedDataBinderTests { public void setInfo(Map nested) { this.info = nested; } + } public static class TargetWithNestedMap { + private Map nested; public Map getNested() { @@ -499,9 +501,11 @@ public class RelaxedDataBinderTests { public void setNested(Map nested) { this.nested = nested; } + } public static class TargetWithNestedMapOfString { + private Map nested; public Map getNested() { @@ -511,9 +515,11 @@ public class RelaxedDataBinderTests { public void setNested(Map nested) { this.nested = nested; } + } public static class TargetWithNestedMapOfListOfString { + private Map> nested; public Map> getNested() { @@ -523,9 +529,11 @@ public class RelaxedDataBinderTests { public void setNested(Map> nested) { this.nested = nested; } + } public static class TargetWithNestedMapOfListOfBean { + private Map> nested; public Map> getNested() { @@ -535,9 +543,11 @@ public class RelaxedDataBinderTests { public void setNested(Map> nested) { this.nested = nested; } + } public static class TargetWithNestedMapOfBean { + private Map nested; public Map getNested() { @@ -547,9 +557,11 @@ public class RelaxedDataBinderTests { public void setNested(Map nested) { this.nested = nested; } + } public static class TargetWithNestedList { + private List nested; public List getNested() { @@ -559,33 +571,41 @@ public class RelaxedDataBinderTests { public void setNested(List nested) { this.nested = nested; } + } public static class TargetWithReadOnlyNestedList { + private final List nested = new ArrayList(); public List getNested() { return this.nested; } + } public static class TargetWithReadOnlyDoubleNestedList { + TargetWithReadOnlyNestedList bean = new TargetWithReadOnlyNestedList(); public TargetWithReadOnlyNestedList getBean() { return this.bean; } + } public static class TargetWithReadOnlyNestedCollection { + private final Collection nested = new ArrayList(); public Collection getNested() { return this.nested; } + } public static class TargetWithNestedSet { + private Set nested = new LinkedHashSet(); public Set getNested() { @@ -595,6 +615,7 @@ public class RelaxedDataBinderTests { public void setNested(Set nested) { this.nested = nested; } + } public static class TargetWithNestedObject { @@ -650,6 +671,7 @@ public class RelaxedDataBinderTests { public void setFooBaz(String fooBaz) { this.fooBaz = fooBaz; } + } public static class ValidatedTarget {