From 7f8944d00fd7d3cdd7c4889e808d498b53a18400 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 19 Aug 2019 17:31:56 +0100 Subject: [PATCH] Polish --- .../hateoas/HypermediaAutoConfiguration.java | 9 --------- .../HypermediaAutoConfigurationTests.java | 2 -- .../AbstractTypeToEnumConverterFactory.java | 6 ++++-- .../BooleanToEnumConverterFactory.java | 2 +- .../boot/reactor/package-info.java | 20 +++++++++++++++++++ .../boot/logging/LoggerGroupsTests.java | 3 --- 6 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 spring-boot-project/spring-boot/src/main/java/org/springframework/boot/reactor/package-info.java diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java index 3a831c6980..27f1bc188d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java @@ -32,10 +32,8 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.hateoas.EntityModel; import org.springframework.hateoas.client.LinkDiscoverers; -import org.springframework.hateoas.config.EnableEntityLinks; import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType; -import org.springframework.hateoas.server.EntityLinks; import org.springframework.plugin.core.Plugin; import org.springframework.web.bind.annotation.RequestMapping; @@ -65,11 +63,4 @@ public class HypermediaAutoConfiguration { } - @Configuration(proxyBeanMethods = false) - @ConditionalOnMissingBean(EntityLinks.class) - @EnableEntityLinks - protected static class EntityLinksConfiguration { - - } - } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java index 1d02e4306a..229eaf7c28 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java @@ -22,7 +22,6 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; -import org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration.EntityLinksConfiguration; import org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration.HypermediaConfiguration; import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; @@ -93,7 +92,6 @@ class HypermediaAutoConfigurationTests { TestPropertyValues.of("spring.jackson.serialization.INDENT_OUTPUT:true").applyTo(this.context); this.context.refresh(); assertThat(this.context.getBeansOfType(HypermediaConfiguration.class)).isEmpty(); - assertThat(this.context.getBeansOfType(EntityLinksConfiguration.class)).isEmpty(); } @Test diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/AbstractTypeToEnumConverterFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/AbstractTypeToEnumConverterFactory.java index 5884d9d1e2..ede8b3f134 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/AbstractTypeToEnumConverterFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/AbstractTypeToEnumConverterFactory.java @@ -36,7 +36,8 @@ import org.springframework.util.MultiValueMap; * @author Phillip Webb * @author Madhura Bhave */ -abstract class AbstractTypeToEnumConverterFactory implements ConverterFactory { +@SuppressWarnings("rawtypes") +abstract class AbstractTypeToEnumConverterFactory implements ConverterFactory> { private static Map> ALIASES; @@ -48,7 +49,7 @@ abstract class AbstractTypeToEnumConverterFactory implements ConverterFactory } @Override - public Converter getConverter(Class targetType) { + public > Converter getConverter(Class targetType) { Class enumType = targetType; while (enumType != null && !enumType.isEnum()) { enumType = enumType.getSuperclass(); @@ -59,6 +60,7 @@ abstract class AbstractTypeToEnumConverterFactory implements ConverterFactory abstract Converter getTypeToEnumConverter(Class targetType); + @SuppressWarnings("unchecked") E findEnum(String source, Class enumType) { Map candidates = new LinkedHashMap<>(); for (E candidate : (Set) EnumSet.allOf(enumType)) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/BooleanToEnumConverterFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/BooleanToEnumConverterFactory.java index 5ae4d9fe32..4ce9486e9a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/BooleanToEnumConverterFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/BooleanToEnumConverterFactory.java @@ -24,7 +24,7 @@ import org.springframework.core.convert.converter.Converter; * * @author Madhura Bhave */ -@SuppressWarnings({ "unchecked", "rawtypes" }) +@SuppressWarnings("rawtypes") final class BooleanToEnumConverterFactory extends AbstractTypeToEnumConverterFactory { @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/reactor/package-info.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/reactor/package-info.java new file mode 100644 index 0000000000..564735248f --- /dev/null +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/reactor/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-2019 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Support classes for Reactor integration. + */ +package org.springframework.boot.reactor; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LoggerGroupsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LoggerGroupsTests.java index fb95f64825..2da362b13f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LoggerGroupsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LoggerGroupsTests.java @@ -25,7 +25,6 @@ import java.util.Map; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; /** * Tests for {@link LoggerGroups} @@ -35,8 +34,6 @@ import static org.mockito.Mockito.mock; */ class LoggerGroupsTests { - private LoggingSystem loggingSystem = mock(LoggingSystem.class); - @Test void putAllShouldAddLoggerGroups() { Map> groups = Collections.singletonMap("test",