From b9fd99e2689e895aa9c1c770003cab5f7eb85933 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 2 Jun 2017 13:47:05 -0700 Subject: [PATCH] Polish --- .../boot/actuate/endpoint/CachePublicMetrics.java | 4 +++- .../endpoint/ConfigurationPropertiesReportEndpoint.java | 3 ++- .../boot/actuate/health/AbstractHealthIndicator.java | 2 +- ...urationPropertiesReportEndpointSerializationTests.java | 8 +++----- .../boot/autoconfigure/condition/ConditionalOnBean.java | 7 +++---- .../autoconfigure/condition/ConditionalOnMissingBean.java | 6 +++--- .../autoconfigure/session/SessionAutoConfiguration.java | 6 ++---- .../autoconfigure/LocalDevToolsAutoConfiguration.java | 2 +- 8 files changed, 18 insertions(+), 20 deletions(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java index 5b11bebfc80..a91f7607900 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java @@ -105,7 +105,8 @@ public class CachePublicMetrics implements PublicMetrics { } private Cache unwrapIfNecessary(Cache cache) { - if (ClassUtils.isPresent("org.springframework.cache.transaction.TransactionAwareCacheDecorator", + if (ClassUtils.isPresent( + "org.springframework.cache.transaction.TransactionAwareCacheDecorator", getClass().getClassLoader())) { return TransactionAwareCacheDecoratorHandler.unwrapIfNecessary(cache); } @@ -165,6 +166,7 @@ public class CachePublicMetrics implements PublicMetrics { } return cache; } + } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java index 145d3c8759b..2b89e4e901a 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java @@ -340,7 +340,8 @@ public class ConfigurationPropertiesReportEndpoint // that's what the metadata generator does. This filter is not used if there // is JSON metadata for the property, so it's mainly for user-defined beans. return (setter != null) - || ClassUtils.getPackageName(parentType).equals(ClassUtils.getPackageName(type)) + || ClassUtils.getPackageName(parentType) + .equals(ClassUtils.getPackageName(type)) || Map.class.isAssignableFrom(type) || Collection.class.isAssignableFrom(type); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java index 81145fc3027..d48e861f9ee 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java index 851410edee8..8042634ecf3 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -217,11 +217,9 @@ public class ConfigurationPropertiesReportEndpointSerializationTests { Map propertiesMap = (Map) nestedProperties .get("properties"); assertThat(propertiesMap).containsOnlyKeys("bar", "name", "map", "list"); - Map map = (Map) propertiesMap - .get("map"); + Map map = (Map) propertiesMap.get("map"); assertThat(map).containsOnly(entry("entryOne", true)); - List list = (List) propertiesMap - .get("list"); + List list = (List) propertiesMap.get("list"); assertThat(list).containsExactly("abc"); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java index 66beaf1cfde..d3a2aa54e50 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -29,9 +29,8 @@ import org.springframework.context.annotation.Conditional; /** * {@link Conditional} that only matches when the specified bean classes and/or names are - * already contained in the {@link BeanFactory}. - * When placed on a {@code @Bean} method, the bean class default to the return type of - * the factory method: + * already contained in the {@link BeanFactory}. When placed on a {@code @Bean} method, + * the bean class default to the return type of the factory method: * *
  * @Configuration
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java
index b75aefc3a75..83b2a06bb5d 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 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.
@@ -31,8 +31,8 @@ import org.springframework.context.annotation.Conditional;
  * {@link Conditional} that only matches when the specified bean classes and/or names are
  * not already contained in the {@link BeanFactory}.
  * 

- * When placed on a {@code @Bean} method, the bean class default to the return type of - * the factory method: + * When placed on a {@code @Bean} method, the bean class default to the return type of the + * factory method: * *

  * @Configuration
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java
index 6b1e4ca121f..848e753097c 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java
@@ -102,10 +102,8 @@ public class SessionAutoConfiguration {
 							+ "auto-configured, check your configuration (session store "
 							+ "type is '" + storeType.name().toLowerCase() + "')");
 				}
-				else {
-					throw new IllegalArgumentException("No Spring Session store is "
-							+ "configured: set the 'spring.session.store-type' property");
-				}
+				throw new IllegalArgumentException("No Spring Session store is "
+						+ "configured: set the 'spring.session.store-type' property");
 			}
 		}
 
diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java
index 3e7db4b8d1b..f5bdc16b186 100644
--- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java
+++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012-2016 the original author or authors.
+ * Copyright 2012-2017 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.