diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryAuthorizationException.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryAuthorizationException.java index adadcabc61..010e576711 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryAuthorizationException.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryAuthorizationException.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/mappings/MappingsEndpointAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/mappings/MappingsEndpointAutoConfiguration.java index 622ce38fd2..6c14809f29 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/mappings/MappingsEndpointAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/mappings/MappingsEndpointAutoConfiguration.java @@ -77,8 +77,7 @@ public class MappingsEndpointAutoConfiguration { static class SpringMvcConfiguration { @Bean - DispatcherServletsMappingDescriptionProvider dispatcherServletMappingDescriptionProvider( - ApplicationContext applicationContext) { + DispatcherServletsMappingDescriptionProvider dispatcherServletMappingDescriptionProvider() { return new DispatcherServletsMappingDescriptionProvider(); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/RequestPredicateFactory.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/RequestPredicateFactory.java index f962552043..8ce5291b81 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/RequestPredicateFactory.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/RequestPredicateFactory.java @@ -53,7 +53,7 @@ class RequestPredicateFactory { public WebOperationRequestPredicate getRequestPredicate(String endpointId, String rootPath, DiscoveredOperationMethod operationMethod) { Method method = operationMethod.getMethod(); - String path = getPath(endpointId, rootPath, method); + String path = getPath(rootPath, method); WebEndpointHttpMethod httpMethod = determineHttpMethod( operationMethod.getOperationType()); Collection consumes = getConsumes(httpMethod, method); @@ -61,7 +61,7 @@ class RequestPredicateFactory { return new WebOperationRequestPredicate(path, httpMethod, consumes, produces); } - private String getPath(String endpointId, String rootPath, Method method) { + private String getPath(String rootPath, Method method) { return rootPath + Stream.of(method.getParameters()).filter(this::hasSelector) .map(this::slashName).collect(Collectors.joining()); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java index f958006b52..7d71193e86 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -62,7 +62,7 @@ public class DataSourcePoolMetrics implements MeterBinder { Assert.notNull(dataSource, "DataSource must not be null"); Assert.notNull(metadataProvider, "MetadataProvider must not be null"); this.dataSource = dataSource; - this.metadataProvider = new CachingDataSourcePoolMetadataProvider(dataSource, + this.metadataProvider = new CachingDataSourcePoolMetadataProvider( metadataProvider); this.name = name; this.tags = tags; @@ -97,7 +97,7 @@ public class DataSourcePoolMetrics implements MeterBinder { private final DataSourcePoolMetadataProvider metadataProvider; - CachingDataSourcePoolMetadataProvider(DataSource dataSource, + CachingDataSourcePoolMetadataProvider( DataSourcePoolMetadataProvider metadataProvider) { this.metadataProvider = metadataProvider; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java index 6bb0ac0f80..a794c2e400 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java @@ -167,7 +167,7 @@ final class BeanTypeRegistry implements SmartInitializingSingleton { String factoryName = BeanFactory.FACTORY_BEAN_PREFIX + name; if (this.beanFactory.isFactoryBean(factoryName)) { Class factoryBeanGeneric = getFactoryBeanGeneric(this.beanFactory, - beanDefinition, name); + beanDefinition); this.beanTypes.put(name, factoryBeanGeneric); this.beanTypes.put(factoryName, this.beanFactory.getType(factoryName)); @@ -216,13 +216,12 @@ final class BeanTypeRegistry implements SmartInitializingSingleton { * generics in its method signature. * @param beanFactory the source bean factory * @param definition the bean definition - * @param name the name of the bean * @return the generic type of the {@link FactoryBean} or {@code null} */ private Class getFactoryBeanGeneric(ConfigurableListableBeanFactory beanFactory, - BeanDefinition definition, String name) { + BeanDefinition definition) { try { - return doGetFactoryBeanGeneric(beanFactory, definition, name); + return doGetFactoryBeanGeneric(beanFactory, definition); } catch (Exception ex) { return null; @@ -230,11 +229,11 @@ final class BeanTypeRegistry implements SmartInitializingSingleton { } private Class doGetFactoryBeanGeneric(ConfigurableListableBeanFactory beanFactory, - BeanDefinition definition, String name) + BeanDefinition definition) throws Exception, ClassNotFoundException, LinkageError { if (StringUtils.hasLength(definition.getFactoryBeanName()) && StringUtils.hasLength(definition.getFactoryMethodName())) { - return getConfigurationClassFactoryBeanGeneric(beanFactory, definition, name); + return getConfigurationClassFactoryBeanGeneric(beanFactory, definition); } if (StringUtils.hasLength(definition.getBeanClassName())) { return getDirectFactoryBeanGeneric(beanFactory, definition); @@ -243,8 +242,8 @@ final class BeanTypeRegistry implements SmartInitializingSingleton { } private Class getConfigurationClassFactoryBeanGeneric( - ConfigurableListableBeanFactory beanFactory, BeanDefinition definition, - String name) throws Exception { + ConfigurableListableBeanFactory beanFactory, BeanDefinition definition) + throws Exception { Method method = getFactoryMethod(beanFactory, definition); Class generic = ResolvableType.forMethodReturnType(method) .as(FactoryBean.class).resolveGeneric(); @@ -305,8 +304,8 @@ final class BeanTypeRegistry implements SmartInitializingSingleton { } private Class getDirectFactoryBeanGeneric( - ConfigurableListableBeanFactory beanFactory, - BeanDefinition definition) throws ClassNotFoundException, LinkageError { + ConfigurableListableBeanFactory beanFactory, BeanDefinition definition) + throws ClassNotFoundException, LinkageError { Class factoryBeanClass = ClassUtils.forName(definition.getBeanClassName(), beanFactory.getBeanClassLoader()); Class generic = ResolvableType.forClass(factoryBeanClass).as(FactoryBean.class) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/AbstractSessionCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/AbstractSessionCondition.java index 0bf342e9d1..a23c1c7508 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/AbstractSessionCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/AbstractSessionCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -49,7 +49,8 @@ abstract class AbstractSessionCondition extends SpringBootCondition { ConditionMessage.Builder message = ConditionMessage .forCondition("Session Condition"); Environment environment = context.getEnvironment(); - StoreType required = SessionStoreMappings.getType(((AnnotationMetadata) metadata).getClassName()); + StoreType required = SessionStoreMappings.getType(this.webApplicationType, + ((AnnotationMetadata) metadata).getClassName()); if (!environment.containsProperty("spring.session.store-type")) { return ConditionOutcome.match(message.didNotFind("property", "properties") .items(ConditionMessage.Style.QUOTE, "spring.session.store-type")); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java index 6d473e14d9..4c7a5e2335 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java @@ -106,8 +106,7 @@ public class SessionAutoConfiguration { */ abstract static class SessionConfigurationImportSelector implements ImportSelector { - protected final String[] selectImports(AnnotationMetadata importingClassMetadata, - WebApplicationType webApplicationType) { + protected final String[] selectImports(WebApplicationType webApplicationType) { List imports = new ArrayList<>(); StoreType[] types = StoreType.values(); for (int i = 0; i < types.length; i++) { @@ -128,8 +127,7 @@ public class SessionAutoConfiguration { @Override public String[] selectImports(AnnotationMetadata importingClassMetadata) { - return super.selectImports(importingClassMetadata, - WebApplicationType.REACTIVE); + return super.selectImports(WebApplicationType.REACTIVE); } } @@ -143,8 +141,7 @@ public class SessionAutoConfiguration { @Override public String[] selectImports(AnnotationMetadata importingClassMetadata) { - return super.selectImports(importingClassMetadata, - WebApplicationType.SERVLET); + return super.selectImports(WebApplicationType.SERVLET); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java index 380a76a848..d9565b564c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java @@ -80,12 +80,14 @@ final class SessionStoreMappings { return configurationClass.getName(); } - static StoreType getType(String configurationClassName) { + static StoreType getType(WebApplicationType webApplicationType, + String configurationClassName) { for (Map.Entry>> storeEntry : MAPPINGS .entrySet()) { for (Map.Entry> entry : storeEntry.getValue() .entrySet()) { - if (entry.getValue().getName().equals(configurationClassName)) { + if (entry.getKey() == webApplicationType + && entry.getValue().getName().equals(configurationClassName)) { return storeEntry.getKey(); } } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java index 29ca0da112..a429594990 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/SmartImportCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java index d5392997d5..be0bb5163e 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringBootCompilerAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java index eff020d331..d5e2ce5842 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -178,15 +178,20 @@ public class JsonTestersAutoConfiguration { } private void processField(Object bean, Field field) { - if (AbstractJsonMarshalTester.class.isAssignableFrom(field.getType()) - || BasicJsonTester.class.isAssignableFrom(field.getType())) { - ResolvableType type = ResolvableType.forField(field).getGeneric(); - ReflectionUtils.makeAccessible(field); - Object tester = ReflectionUtils.getField(field, bean); - if (tester != null) { - ReflectionTestUtils.invokeMethod(tester, "initialize", - bean.getClass(), type); - } + if (AbstractJsonMarshalTester.class.isAssignableFrom(field.getType())) { + initializeTester(bean, field, bean.getClass(), + ResolvableType.forField(field).getGeneric()); + } + else if (BasicJsonTester.class.isAssignableFrom(field.getType())) { + initializeTester(bean, field, bean.getClass()); + } + } + + private void initializeTester(Object bean, Field field, Object... args) { + ReflectionUtils.makeAccessible(field); + Object tester = ReflectionUtils.getField(field, bean); + if (tester != null) { + ReflectionTestUtils.invokeMethod(tester, "initialize", args); } } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java index 4909f174ad..187d834a07 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -20,7 +20,6 @@ import java.io.File; import java.io.InputStream; import java.nio.charset.Charset; -import org.springframework.core.ResolvableType; import org.springframework.core.io.Resource; import org.springframework.util.Assert; @@ -80,10 +79,9 @@ public class BasicJsonTester { * UTF-8. * @param resourceLoadClass the source class used when loading relative classpath * resources - * @param type the type under test */ - protected final void initialize(Class resourceLoadClass, ResolvableType type) { - this.initialize(resourceLoadClass, null, type); + protected final void initialize(Class resourceLoadClass) { + this.initialize(resourceLoadClass, null); } /** @@ -91,11 +89,9 @@ public class BasicJsonTester { * @param resourceLoadClass the source class used when loading relative classpath * resources * @param charset the charset used when loading relative classpath resources - * @param type the type under test * @since 1.4.1 */ - protected final void initialize(Class resourceLoadClass, Charset charset, - ResolvableType type) { + protected final void initialize(Class resourceLoadClass, Charset charset) { if (this.loader == null) { this.loader = new JsonLoader(resourceLoadClass, charset); } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java index d756f452df..73d7744978 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -97,7 +97,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda private Map beanNameRegistry = new HashMap<>(); - private Map fieldRegistry = new HashMap<>(); + private Map fieldRegistry = new HashMap<>(); private Map spies = new HashMap<>(); @@ -194,7 +194,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda this.mockitoBeans.add(mock); this.beanNameRegistry.put(definition, beanName); if (field != null) { - this.fieldRegistry.put(field, new RegisteredField(definition, beanName)); + this.fieldRegistry.put(field, beanName); } } @@ -347,7 +347,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda this.spies.put(beanName, definition); this.beanNameRegistry.put(definition, beanName); if (field != null) { - this.fieldRegistry.put(field, new RegisteredField(definition, beanName)); + this.fieldRegistry.put(field, beanName); } } @@ -370,9 +370,9 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda } private void postProcessField(Object bean, Field field) { - RegisteredField registered = this.fieldRegistry.get(field); - if (registered != null && StringUtils.hasLength(registered.getBeanName())) { - inject(field, bean, registered.getBeanName()); + String beanName = this.fieldRegistry.get(field); + if (StringUtils.hasText(beanName)) { + inject(field, bean, beanName); } } @@ -511,28 +511,4 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda } - /** - * A registered field item. - */ - private static class RegisteredField { - - private final Definition definition; - - private final String beanName; - - RegisteredField(Definition definition, String beanName) { - this.definition = definition; - this.beanName = beanName; - } - - public Definition getDefinition() { - return this.definition; - } - - public String getBeanName() { - return this.beanName; - } - - } - } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplateTestContextCustomizer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplateTestContextCustomizer.java index 205029345a..7ba5742537 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplateTestContextCustomizer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplateTestContextCustomizer.java @@ -62,12 +62,11 @@ class TestRestTemplateTestContextCustomizer implements ContextCustomizer { private void registerTestRestTemplate(ConfigurableApplicationContext context) { ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); if (beanFactory instanceof BeanDefinitionRegistry) { - registerTestRestTemplate(context, (BeanDefinitionRegistry) context); + registerTestRestTemplate((BeanDefinitionRegistry) context); } } - private void registerTestRestTemplate(ConfigurableApplicationContext context, - BeanDefinitionRegistry registry) { + private void registerTestRestTemplate(BeanDefinitionRegistry registry) { RootBeanDefinition definition = new RootBeanDefinition( TestRestTemplateRegistrar.class); definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFileEntries.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFileEntries.java index 0085b2fe34..f402dff0c3 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFileEntries.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFileEntries.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ArrayBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ArrayBinder.java index eeecc65a73..70dac91032 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ArrayBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ArrayBinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -41,8 +41,7 @@ class ArrayBinder extends IndexedElementsBinder { IndexedCollectionSupplier collection = new IndexedCollectionSupplier( ArrayList::new); ResolvableType elementType = target.getType().getComponentType(); - bindIndexed(name, target, elementBinder, collection, target.getType(), - elementType); + bindIndexed(name, elementBinder, collection, target.getType(), elementType); if (collection.wasSupplied()) { List list = (List) collection.get(); Object array = Array.newInstance(elementType.resolve(), list.size()); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java index 9750aad885..625cfbdbc4 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java @@ -295,7 +295,8 @@ public class Binder { .filter(Objects::nonNull).findFirst().orElse(null); } - private Object bindProperty(Bindable target, Context context, ConfigurationProperty property) { + private Object bindProperty(Bindable target, Context context, + ConfigurationProperty property) { context.setConfigurationProperty(property); Object result = property.getValue(); result = this.placeholdersResolver.resolvePlaceholders(result); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java index 9e45f5c789..dd52f16201 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -45,7 +45,7 @@ class CollectionBinder extends IndexedElementsBinder> { ResolvableType elementType = target.getType().asCollection().getGeneric(); ResolvableType aggregateType = ResolvableType.forClassWithGenerics(List.class, target.getType().asCollection().getGenerics()); - bindIndexed(name, target, elementBinder, collection, aggregateType, elementType); + bindIndexed(name, elementBinder, collection, aggregateType, elementType); if (collection.wasSupplied()) { return collection.get(); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java index 2710493c03..8b56826658 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -53,7 +53,7 @@ abstract class IndexedElementsBinder extends AggregateBinder { return source == null || source instanceof IterableConfigurationPropertySource; } - protected final void bindIndexed(ConfigurationPropertyName name, Bindable target, + protected final void bindIndexed(ConfigurationPropertyName name, AggregateElementBinder elementBinder, IndexedCollectionSupplier collection, ResolvableType aggregateType, ResolvableType elementType) { for (ConfigurationPropertySource source : getContext().getSources()) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java index 7114145455..efdd118608 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatErrorPage.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatErrorPage.java index 0e13935ad8..3f74389dc4 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatErrorPage.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatErrorPage.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/SslBuilderCustomizer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/SslBuilderCustomizer.java index 04f6061c7c..3aaa311f45 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/SslBuilderCustomizer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/SslBuilderCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -72,8 +72,7 @@ class SslBuilderCustomizer implements UndertowBuilderCustomizer { SSLContext sslContext = SSLContext.getInstance(this.ssl.getProtocol()); sslContext.init(getKeyManagers(this.ssl, this.sslStoreProvider), getTrustManagers(this.ssl, this.sslStoreProvider), null); - builder.addHttpsListener(this.port, getListenAddress(), - sslContext); + builder.addHttpsListener(this.port, getListenAddress(), sslContext); builder.setSocketOption(Options.SSL_CLIENT_AUTH_MODE, getSslClientAuthMode(this.ssl)); if (this.ssl.getEnabledProtocols() != null) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java index ca5cdac941..4eb37be3e0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -48,10 +48,9 @@ abstract class ServletComponentHandler { return this.typeFilter; } - protected String[] extractUrlPatterns(String attribute, - Map attributes) { + protected String[] extractUrlPatterns(Map attributes) { String[] value = (String[]) attributes.get("value"); - String[] urlPatterns = (String[]) attributes.get(attribute); + String[] urlPatterns = (String[]) attributes.get("urlPatterns"); if (urlPatterns.length > 0) { Assert.state(value.length == 0, "The urlPatterns and value attributes are mutually exclusive."); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebFilterHandler.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebFilterHandler.java index e8ed855ce7..ccdfac65bc 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebFilterHandler.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebFilterHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -53,8 +53,7 @@ class WebFilterHandler extends ServletComponentHandler { String name = determineName(attributes, beanDefinition); builder.addPropertyValue("name", name); builder.addPropertyValue("servletNames", attributes.get("servletNames")); - builder.addPropertyValue("urlPatterns", - extractUrlPatterns("urlPatterns", attributes)); + builder.addPropertyValue("urlPatterns", extractUrlPatterns(attributes)); registry.registerBeanDefinition(name, builder.getBeanDefinition()); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebServletHandler.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebServletHandler.java index edad3ffb7f..f50f0b8e20 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebServletHandler.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/WebServletHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -51,8 +51,7 @@ class WebServletHandler extends ServletComponentHandler { String name = determineName(attributes, beanDefinition); builder.addPropertyValue("name", name); builder.addPropertyValue("servlet", beanDefinition); - builder.addPropertyValue("urlMappings", - extractUrlPatterns("urlPatterns", attributes)); + builder.addPropertyValue("urlMappings", extractUrlPatterns(attributes)); builder.addPropertyValue("multipartConfig", determineMultipartConfig(beanDefinition)); registry.registerBeanDefinition(name, builder.getBeanDefinition());