From 31ed70e1b8448587454ea125ac3f000506dfb5f4 Mon Sep 17 00:00:00 2001 From: John Blum Date: Sun, 5 Feb 2017 23:55:41 -0800 Subject: [PATCH 1/3] Improve spring-boot-sample-cache UX by using Maven profiles See gh-8202 --- .../spring-boot-sample-cache/README.adoc | 8 + .../spring-boot-sample-cache/pom.xml | 181 +++++++++++------- 2 files changed, 117 insertions(+), 72 deletions(-) diff --git a/spring-boot-samples/spring-boot-sample-cache/README.adoc b/spring-boot-samples/spring-boot-sample-cache/README.adoc index 7bc450fb397..0e0d7c4c786 100644 --- a/spring-boot-samples/spring-boot-sample-cache/README.adoc +++ b/spring-boot-samples/spring-boot-sample-cache/README.adoc @@ -64,6 +64,7 @@ used to configure the underlying `CacheManager`. Note that EhCache 3 uses a diff format and doesn't default to `ehcache.xml` anymore. Check http://www.ehcache.org/documentation/3.0/xml.html[the documentation] for more details. +Run sample cache application using EhCache with `$mvn -P ehcache spring-boot:run` === Hazelcast @@ -72,6 +73,7 @@ the project to enable support for Hazelcast. Since there is a default `hazelcas configuration file at the root of the classpath, it is used to automatically configure the underlying `HazelcastInstance`. +Run sample cache application using Hazelcast with `$mvn -P hazelcast spring-boot:run` === Infinispan @@ -81,18 +83,21 @@ so if you don't specify anything it will bootstrap on a hardcoded default. You c the `spring.cache.infinispan.config` property to use the provided `infinispan.xml` configuration instead. +Run sample cache application using Infinispan with `$mvn -P infinispan spring-boot:run` === Couchbase Add the `java-client` and `couchbase-spring-cache` dependencies and make sure that you have setup at least a `spring.couchbase.bootstrap-hosts` property. +Start a Couchbase server, then run the sample cache application using Couchbase with `$mvn -P couchbase spring-boot:run` === Redis Add the `spring-boot-starter-data-redis` and make sure it is configured properly (by default, a redis instance with the default settings is expected on your local box). +Start a Redis server, then run the sample cache application using Redis with `$mvn -P redis spring-boot:run` === Caffeine @@ -100,6 +105,7 @@ Simply add the `com.github.ben-manes.caffeine:caffeine` dependency to enable sup for Caffeine. You can customize how caches are created in different ways, see `application.properties` for an example and the documentation for more details. +Run sample cache application using Caffeine with `$mvn -P caffeine spring-boot:run` === Guava @@ -107,3 +113,5 @@ Spring Boot does not provide any dependency management for _Guava_ so you'll hav the `com.google.guava:guava` dependency with a version. You can customize how caches are created in different ways, see `application.properties` for an example and the documentation for more details. + +Run sample cache application using Guava with `$mvn -P guava spring-boot:run` diff --git a/spring-boot-samples/spring-boot-sample-cache/pom.xml b/spring-boot-samples/spring-boot-sample-cache/pom.xml index 8a5eb6c092b..91035e716bf 100644 --- a/spring-boot-samples/spring-boot-sample-cache/pom.xml +++ b/spring-boot-samples/spring-boot-sample-cache/pom.xml @@ -33,78 +33,6 @@ org.springframework.boot spring-boot-starter-actuator - - - - - - - - - - - - - - org.springframework.boot @@ -120,4 +48,113 @@ + + + + + jcache + + + javax.cache + cache-api + + + + + + caffeine + + + com.github.ben-manes.caffeine + caffeine + + + + + + + couchbase + + + com.couchbase.client + java-client + + + com.couchbase.client + couchbase-spring-cache + + + + + + ehcache + + + net.sf.ehcache + ehcache + + + + + + + org-ehcache + + + org.ehcache + ehcache + + + + + + guava + + + com.google.guava + guava + 18.0 + + + + + + hazelcast + + + com.hazelcast + hazelcast + + + com.hazelcast + hazelcast-spring + + + + + + infinispan + + + org.infinispan + infinispan-spring4-embedded + + + org.infinispan + infinispan-jcache + + + + + + + redis + + + org.springframework.boot + spring-boot-starter-data-redis + + + + From 4d7b03b00220d7d7f4723c2013f3b9f71e919b6c Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 6 Feb 2017 10:34:22 +0100 Subject: [PATCH 2/3] Polish contribution Closes gh-8202 --- .../spring-boot-sample-cache/README.adoc | 93 +++++++++++-------- .../spring-boot-sample-cache/pom.xml | 41 ++++---- 2 files changed, 70 insertions(+), 64 deletions(-) diff --git a/spring-boot-samples/spring-boot-sample-cache/README.adoc b/spring-boot-samples/spring-boot-sample-cache/README.adoc index 0e0d7c4c786..9debe16c563 100644 --- a/spring-boot-samples/spring-boot-sample-cache/README.adoc +++ b/spring-boot-samples/spring-boot-sample-cache/README.adoc @@ -15,8 +15,8 @@ abstraction is supported by many caching libraries, including: * Generic provider based on `org.springframework.Cache` bean definition(s) The sample defines a simple `CountryService` that caches countries by ISO code. When -the application starts a client invokes the service with a random code every 500ms. You -can look at the `/metrics` endpoint to review the cache statistics if your chosen +the application starts a client invokes the service with a random code every 500ms. +You can look at the `/metrics` endpoint to review the cache statistics if your chosen caching provider is supported. @@ -26,30 +26,31 @@ The sample uses Spring's cache annotation. If you want to use the JSR-107 annota instead, simply add the `javax.cache:cache-api` dependency to the project. No further configuration is necessary. -NOTE: You can use the JSR-107 annotations with _any_ cache provider; a JSR-107 compliant -cache provider is not necessary. +NOTE: You can use the JSR-107 annotations with _any_ cache provider; a JSR-107 +compliant cache provider is not necessary. == Using a different cache provider Initially, the project does not define any caching library so the abstraction works -on simple `ConcurrentHashMap`-based caches. You can try out your favorite caching library -as explained below. +on simple `ConcurrentHashMap`-based caches. You can try out your favorite caching +library as explained below. === JCache (JSR-107) -If you want to configure your cache infrastructure via the standard, you need a compliant -implementation and the JSR-107 api. You first need to add `javax.cache:cache-api` to your -project. Then you could try the following: +If you want to configure your cache infrastructure via the standard, you need a +compliant implementation and the JSR-107 api. You first need to add +`javax.cache:cache-api` to your project. Then you could try the following: * `EhCache 3`: add `org.ehcache:ehcache` * `Hazelcast`: add `com.hazelcast:hazelcast` * `Infinispan`: add `org.infinispan:infinispan-jcache` -TIP: Certain cache providers do not create a default cache on-the-fly if it does not exist -so you might need to update the sample to create the caches on startup or specify the -location to the provider-specific file via the `spring.cache.jcache.config` property. +TIP: Certain cache providers do not create a default cache on-the-fly if it does not +exist so you might need to update the sample to create the caches on startup or +specify the location to the provider-specific file via the +`spring.cache.jcache.config` property. NOTE: Any other JSR-107 compliant provider is also supported but Spring Boot may not offer a dependency management entry for it. You will have to add it with the version @@ -59,45 +60,56 @@ of the library that you want to use. === EhCache 2.x Simply add the `net.sf.ehcache:ehcache` dependency to the project. Since there is a -default `ehcache.xml` configuration file at the root of the classpath, it is automatically -used to configure the underlying `CacheManager`. Note that EhCache 3 uses a different -format and doesn't default to `ehcache.xml` anymore. Check -http://www.ehcache.org/documentation/3.0/xml.html[the documentation] for more details. +default `ehcache.xml` configuration file at the root of the classpath, +it is automatically used to configure the underlying `CacheManager`. +Note that EhCache 3 uses a different format and doesn't default to `ehcache.xml` +anymore. Check http://www.ehcache.org/documentation/3.0/xml.html[the documentation] +for more details. + +TIP: Run sample cache application using EhCache with +`$mvn spring-boot:run -Pehcache2`. -Run sample cache application using EhCache with `$mvn -P ehcache spring-boot:run` === Hazelcast -Both `com.hazelcast:hazelcast` and `com.hazelcast:hazelcast-spring` should be added to -the project to enable support for Hazelcast. Since there is a default `hazelcast.xml` -configuration file at the root of the classpath, it is used to automatically configure -the underlying `HazelcastInstance`. +Both `com.hazelcast:hazelcast` and `com.hazelcast:hazelcast-spring` should be added +to the project to enable support for Hazelcast. Since there is a default +`hazelcast.xml` configuration file at the root of the classpath, it is used to +automatically configure the underlying `HazelcastInstance`. + +TIP: Run sample cache application using Hazelcast with +`$mvn spring-boot:run -Phazelcast`. -Run sample cache application using Hazelcast with `$mvn -P hazelcast spring-boot:run` === Infinispan Add the `org.infinispan:infinispan-spring4-embedded` dependency to enable support for -Infinispan. There is no default location that Infinispan uses to look for a config file -so if you don't specify anything it will bootstrap on a hardcoded default. You can set -the `spring.cache.infinispan.config` property to use the provided `infinispan.xml` -configuration instead. +Infinispan. There is no default location that Infinispan uses to look for a config +file so if you don't specify anything it will bootstrap on a hardcoded default. You +can set the `spring.cache.infinispan.config` property to use the provided +`infinispan.xml` configuration instead. + +TIP: Run sample cache application using Hazelcast with +`$mvn spring-boot:run -Pinfinispan`. -Run sample cache application using Infinispan with `$mvn -P infinispan spring-boot:run` === Couchbase -Add the `java-client` and `couchbase-spring-cache` dependencies and make sure that you -have setup at least a `spring.couchbase.bootstrap-hosts` property. +Add the `java-client` and `couchbase-spring-cache` dependencies and make sure that +you have setup at least a `spring.couchbase.bootstrap-hosts` property. + +TIP: Run sample cache application using Hazelcast with +`$mvn spring-boot:run -Pcouchbase`. -Start a Couchbase server, then run the sample cache application using Couchbase with `$mvn -P couchbase spring-boot:run` === Redis -Add the `spring-boot-starter-data-redis` and make sure it is configured properly (by default, -a redis instance with the default settings is expected on your local box). +Add the `spring-boot-starter-data-redis` and make sure it is configured properly (by +default, a redis instance with the default settings is expected on your local box). + +TIP: Run sample cache application using Hazelcast with +`$mvn spring-boot:run -Predis`. -Start a Redis server, then run the sample cache application using Redis with `$mvn -P redis spring-boot:run` === Caffeine @@ -105,13 +117,16 @@ Simply add the `com.github.ben-manes.caffeine:caffeine` dependency to enable sup for Caffeine. You can customize how caches are created in different ways, see `application.properties` for an example and the documentation for more details. -Run sample cache application using Caffeine with `$mvn -P caffeine spring-boot:run` +TIP: Run sample cache application using Hazelcast with +`$mvn spring-boot:run -Pcaffeine`. + === Guava -Spring Boot does not provide any dependency management for _Guava_ so you'll have to add -the `com.google.guava:guava` dependency with a version. You can customize how caches are -created in different ways, see `application.properties` for an example and the -documentation for more details. +Spring Boot does not provide any dependency management for _Guava_ so you'll have to +add the `com.google.guava:guava` dependency with a version. You can customize how +caches are created in different ways, see `application.properties` for an example and +the documentation for more details. -Run sample cache application using Guava with `$mvn -P guava spring-boot:run` +TIP: Run sample cache application using Hazelcast with +`$mvn spring-boot:run -Pguava`. \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-cache/pom.xml b/spring-boot-samples/spring-boot-sample-cache/pom.xml index 91035e716bf..8dfb924f40a 100644 --- a/spring-boot-samples/spring-boot-sample-cache/pom.xml +++ b/spring-boot-samples/spring-boot-sample-cache/pom.xml @@ -49,8 +49,6 @@ - - jcache @@ -60,7 +58,6 @@ - caffeine @@ -70,8 +67,6 @@ - - couchbase @@ -85,9 +80,8 @@ - - ehcache + ehcache2 net.sf.ehcache @@ -95,29 +89,19 @@ - - - org-ehcache + ehcache + + javax.cache + cache-api + org.ehcache ehcache - - - guava - - - com.google.guava - guava - 18.0 - - - - hazelcast @@ -131,7 +115,6 @@ - infinispan @@ -145,8 +128,6 @@ - - redis @@ -156,5 +137,15 @@ + + guava + + + com.google.guava + guava + 18.0 + + + From 0adab8a2be9967d180f3f8ee675e07cc92ef9d70 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Mon, 6 Feb 2017 11:01:18 +0900 Subject: [PATCH 3/3] Use logical 'and' instead of bitwise 'and' Closes gh-8198 --- .../actuate/audit/InMemoryAuditEventRepository.java | 6 +++--- .../springframework/boot/actuate/metrics/Metric.java | 6 +++--- .../embedded/EmbeddedMongoAutoConfiguration.java | 4 ++-- .../boot/cli/compiler/dependencies/Dependency.java | 12 ++++++------ .../boot/devtools/filewatch/FileSnapshot.java | 6 +++--- .../AnnotationCustomizableTypeExcludeFilter.java | 10 +++++----- .../boot/test/mock/mockito/Definition.java | 8 ++++---- .../boot/test/mock/mockito/MockDefinition.java | 8 ++++---- .../boot/test/mock/mockito/SpyDefinition.java | 2 +- .../boot/logging/LoggerConfiguration.java | 6 +++--- .../springframework/boot/web/servlet/ErrorPage.java | 6 +++--- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java index e2677470441..2cf1a5df166 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java @@ -95,9 +95,9 @@ public class InMemoryAuditEventRepository implements AuditEventRepository { private boolean isMatch(String principal, Date after, String type, AuditEvent event) { boolean match = true; - match &= (principal == null || event.getPrincipal().equals(principal)); - match &= (after == null || event.getTimestamp().compareTo(after) >= 0); - match &= (type == null || event.getType().equals(type)); + match = match && (principal == null || event.getPrincipal().equals(principal)); + match = match && (after == null || event.getTimestamp().compareTo(after) >= 0); + match = match && (type == null || event.getType().equals(type)); return match; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java index f9b8421aa86..20430d45940 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java @@ -126,9 +126,9 @@ public class Metric { if (obj instanceof Metric) { Metric other = (Metric) obj; boolean rtn = true; - rtn &= ObjectUtils.nullSafeEquals(this.name, other.name); - rtn &= ObjectUtils.nullSafeEquals(this.timestamp, other.timestamp); - rtn &= ObjectUtils.nullSafeEquals(this.value, other.value); + rtn = rtn && ObjectUtils.nullSafeEquals(this.name, other.name); + rtn = rtn && ObjectUtils.nullSafeEquals(this.timestamp, other.timestamp); + rtn = rtn && ObjectUtils.nullSafeEquals(this.value, other.value); return rtn; } return super.equals(obj); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java index 3f8665fcab6..d63391cdded 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java @@ -280,8 +280,8 @@ public class EmbeddedMongoAutoConfiguration { if (getClass() == obj.getClass()) { ToStringFriendlyFeatureAwareVersion other = (ToStringFriendlyFeatureAwareVersion) obj; boolean equals = true; - equals &= this.features.equals(other.features); - equals &= this.version.equals(other.version); + equals = equals && this.features.equals(other.features); + equals = equals && this.version.equals(other.version); return equals; } return super.equals(obj); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java index a13703e24a9..069024c00ab 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java @@ -125,10 +125,10 @@ public final class Dependency { if (getClass() == obj.getClass()) { Dependency other = (Dependency) obj; boolean result = true; - result &= this.groupId.equals(other.groupId); - result &= this.artifactId.equals(other.artifactId); - result &= this.version.equals(other.version); - result &= this.exclusions.equals(other.exclusions); + result = result && this.groupId.equals(other.groupId); + result = result && this.artifactId.equals(other.artifactId); + result = result && this.version.equals(other.version); + result = result && this.exclusions.equals(other.exclusions); return result; } return false; @@ -187,8 +187,8 @@ public final class Dependency { if (getClass() == obj.getClass()) { Exclusion other = (Exclusion) obj; boolean result = true; - result &= this.groupId.equals(other.groupId); - result &= this.artifactId.equals(other.artifactId); + result = result && this.groupId.equals(other.groupId); + result = result && this.artifactId.equals(other.artifactId); return result; } return false; diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSnapshot.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSnapshot.java index 2759b63fd7c..bc2835df1a0 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSnapshot.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSnapshot.java @@ -59,9 +59,9 @@ class FileSnapshot { if (obj instanceof FileSnapshot) { FileSnapshot other = (FileSnapshot) obj; boolean equals = this.file.equals(other.file); - equals &= this.exists == other.exists; - equals &= this.length == other.length; - equals &= this.lastModified == other.lastModified; + equals = equals && this.exists == other.exists; + equals = equals && this.length == other.length; + equals = equals && this.lastModified == other.lastModified; return equals; } return super.equals(obj); diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java index ceff15ab5c4..fdacaaf74ec 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java @@ -142,17 +142,17 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud } AnnotationCustomizableTypeExcludeFilter other = (AnnotationCustomizableTypeExcludeFilter) obj; boolean result = true; - result &= hasAnnotation() == other.hasAnnotation(); + result = result && hasAnnotation() == other.hasAnnotation(); for (FilterType filterType : FilterType.values()) { result &= ObjectUtils.nullSafeEquals(getFilters(filterType), other.getFilters(filterType)); } - result &= isUseDefaultFilters() == other.isUseDefaultFilters(); - result &= ObjectUtils.nullSafeEquals(getDefaultIncludes(), + result = result && isUseDefaultFilters() == other.isUseDefaultFilters(); + result = result && ObjectUtils.nullSafeEquals(getDefaultIncludes(), other.getDefaultIncludes()); - result &= ObjectUtils.nullSafeEquals(getComponentIncludes(), + result = result && ObjectUtils.nullSafeEquals(getComponentIncludes(), other.getComponentIncludes()); return result; - }; + } } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java index 1a6c641de7f..76cc82260b0 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java @@ -97,11 +97,11 @@ abstract class Definition { } Definition other = (Definition) obj; boolean result = true; - result &= ObjectUtils.nullSafeEquals(this.name, other.name); - result &= ObjectUtils.nullSafeEquals(this.reset, other.reset); - result &= ObjectUtils.nullSafeEquals(this.proxyTargetAware, + result = result && ObjectUtils.nullSafeEquals(this.name, other.name); + result = result && ObjectUtils.nullSafeEquals(this.reset, other.reset); + result = result && ObjectUtils.nullSafeEquals(this.proxyTargetAware, other.proxyTargetAware); - result &= ObjectUtils.nullSafeEquals(this.qualifier, other.qualifier); + result = result && ObjectUtils.nullSafeEquals(this.qualifier, other.qualifier); return result; } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java index 07df1db3fa8..0c9159afad3 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java @@ -120,10 +120,10 @@ class MockDefinition extends Definition { } MockDefinition other = (MockDefinition) obj; boolean result = super.equals(obj); - result &= ObjectUtils.nullSafeEquals(this.typeToMock, other.typeToMock); - result &= ObjectUtils.nullSafeEquals(this.extraInterfaces, other.extraInterfaces); - result &= ObjectUtils.nullSafeEquals(this.answer, other.answer); - result &= this.serializable == other.serializable; + result = result && ObjectUtils.nullSafeEquals(this.typeToMock, other.typeToMock); + result = result && ObjectUtils.nullSafeEquals(this.extraInterfaces, other.extraInterfaces); + result = result && ObjectUtils.nullSafeEquals(this.answer, other.answer); + result = result && this.serializable == other.serializable; return result; } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyDefinition.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyDefinition.java index 172b05aed21..6d17a2ec5e7 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyDefinition.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyDefinition.java @@ -65,7 +65,7 @@ class SpyDefinition extends Definition { } SpyDefinition other = (SpyDefinition) obj; boolean result = super.equals(obj); - result &= ObjectUtils.nullSafeEquals(this.typeToSpy, other.typeToSpy); + result = result && ObjectUtils.nullSafeEquals(this.typeToSpy, other.typeToSpy); return result; } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java index 55098562bb0..9ea1cb6c93f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java @@ -99,10 +99,10 @@ public final class LoggerConfiguration { if (obj instanceof LoggerConfiguration) { LoggerConfiguration other = (LoggerConfiguration) obj; boolean rtn = true; - rtn &= ObjectUtils.nullSafeEquals(this.name, other.name); - rtn &= ObjectUtils.nullSafeEquals(this.configuredLevel, + rtn = rtn && ObjectUtils.nullSafeEquals(this.name, other.name); + rtn = rtn && ObjectUtils.nullSafeEquals(this.configuredLevel, other.configuredLevel); - rtn &= ObjectUtils.nullSafeEquals(this.effectiveLevel, other.effectiveLevel); + rtn = rtn && ObjectUtils.nullSafeEquals(this.effectiveLevel, other.effectiveLevel); return rtn; } return super.equals(obj); diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ErrorPage.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ErrorPage.java index b9c15047de9..c30fdcd5a49 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ErrorPage.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ErrorPage.java @@ -125,10 +125,10 @@ public class ErrorPage { if (obj instanceof ErrorPage) { ErrorPage other = (ErrorPage) obj; boolean rtn = true; - rtn &= ObjectUtils.nullSafeEquals(getExceptionName(), + rtn = rtn && ObjectUtils.nullSafeEquals(getExceptionName(), other.getExceptionName()); - rtn &= ObjectUtils.nullSafeEquals(this.path, other.path); - rtn &= this.status == other.status; + rtn = rtn && ObjectUtils.nullSafeEquals(this.path, other.path); + rtn = rtn && this.status == other.status; return rtn; } return false;