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 391e613452..94193f2c31 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 @@ -94,7 +94,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); } @@ -154,6 +155,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 a55dc96bc9..8934b42a8b 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 @@ -341,7 +341,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/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java index 3dc99187c4..f9d87881b6 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 @@ -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-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/LoggersMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/LoggersMvcEndpointTests.java index 8146d5406b..d849734f9b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/LoggersMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/LoggersMvcEndpointTests.java @@ -150,7 +150,8 @@ public class LoggersMvcEndpointTests { @Test public void setLoggerUsingApplicationJsonShouldSetLogLevel() throws Exception { this.mvc.perform(post(PATH + "/ROOT").contentType(MediaType.APPLICATION_JSON) - .content("{\"configuredLevel\":\"debug\"}")).andExpect(status().isNoContent()); + .content("{\"configuredLevel\":\"debug\"}")) + .andExpect(status().isNoContent()); verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG); } @@ -158,7 +159,8 @@ public class LoggersMvcEndpointTests { public void setLoggerUsingActuatorV2JsonShouldSetLogLevel() throws Exception { this.mvc.perform(post(PATH + "/ROOT") .contentType(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON) - .content("{\"configuredLevel\":\"debug\"}")).andExpect(status().isNoContent()); + .content("{\"configuredLevel\":\"debug\"}")) + .andExpect(status().isNoContent()); verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java index bddf089f29..9adfc94383 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java @@ -190,7 +190,8 @@ public class WebFluxAutoConfigurationTests { .getBeanNamesForType(javax.validation.Validator.class); String[] springValidatorBeans = this.context.getBeanNamesForType(Validator.class); assertThat(jsrValidatorBeans).containsExactly("defaultValidator"); - assertThat(springValidatorBeans).containsExactly("defaultValidator", "webFluxValidator"); + assertThat(springValidatorBeans).containsExactly("defaultValidator", + "webFluxValidator"); Validator validator = this.context.getBean("webFluxValidator", Validator.class); assertThat(validator).isInstanceOf(ValidatorAdapter.class); Object defaultValidator = this.context.getBean("defaultValidator"); @@ -208,13 +209,14 @@ public class WebFluxAutoConfigurationTests { .isEmpty(); String[] springValidatorBeans = this.context.getBeanNamesForType(Validator.class); assertThat(springValidatorBeans).containsExactly("webFluxValidator"); - assertThat(this.context.getBean("webFluxValidator")) - .isSameAs(this.context.getBean(ValidatorWebFluxConfigurer.class).validator); + assertThat(this.context.getBean("webFluxValidator")).isSameAs( + this.context.getBean(ValidatorWebFluxConfigurer.class).validator); } @Test public void validatorWithConfigurerDoesNotExposeJsr303() { - load(ValidatorJsr303WebFluxConfigurer.class, new Class[] { ValidationAutoConfiguration.class }); + load(ValidatorJsr303WebFluxConfigurer.class, + new Class[] { ValidationAutoConfiguration.class }); assertThat(this.context.getBeansOfType(ValidatorFactory.class)).isEmpty(); assertThat(this.context.getBeansOfType(javax.validation.Validator.class)) .isEmpty(); @@ -222,8 +224,8 @@ public class WebFluxAutoConfigurationTests { assertThat(springValidatorBeans).containsExactly("webFluxValidator"); Validator validator = this.context.getBean("webFluxValidator", Validator.class); assertThat(validator).isInstanceOf(ValidatorAdapter.class); - assertThat(((ValidatorAdapter) validator).getTarget()) - .isSameAs(this.context.getBean(ValidatorJsr303WebFluxConfigurer.class).validator); + assertThat(((ValidatorAdapter) validator).getTarget()).isSameAs( + this.context.getBean(ValidatorJsr303WebFluxConfigurer.class).validator); } @Test @@ -233,10 +235,10 @@ public class WebFluxAutoConfigurationTests { assertThat(this.context.getBeansOfType(javax.validation.Validator.class)) .hasSize(1); String[] springValidatorBeans = this.context.getBeanNamesForType(Validator.class); - assertThat(springValidatorBeans) - .containsExactly("defaultValidator", "webFluxValidator"); - assertThat(this.context.getBean("webFluxValidator")) - .isSameAs(this.context.getBean(ValidatorWebFluxConfigurer.class).validator); + assertThat(springValidatorBeans).containsExactly("defaultValidator", + "webFluxValidator"); + assertThat(this.context.getBean("webFluxValidator")).isSameAs( + this.context.getBean(ValidatorWebFluxConfigurer.class).validator); // Primary Spring validator is the auto-configured one as the WebFlux one has been // customized via a WebFluxConfigurer assertThat(this.context.getBean(Validator.class)) @@ -250,13 +252,12 @@ public class WebFluxAutoConfigurationTests { .getBeanNamesForType(javax.validation.Validator.class); String[] springValidatorBeans = this.context.getBeanNamesForType(Validator.class); assertThat(jsrValidatorBeans).containsExactly("defaultValidator"); - assertThat(springValidatorBeans).containsExactly( - "customValidator", "defaultValidator", "webFluxValidator"); + assertThat(springValidatorBeans).containsExactly("customValidator", + "defaultValidator", "webFluxValidator"); Validator validator = this.context.getBean("webFluxValidator", Validator.class); assertThat(validator).isInstanceOf(ValidatorAdapter.class); Object defaultValidator = this.context.getBean("defaultValidator"); - assertThat(((ValidatorAdapter) validator).getTarget()) - .isSameAs(defaultValidator); + assertThat(((ValidatorAdapter) validator).getTarget()).isSameAs(defaultValidator); // Primary Spring validator is the one use by WebFlux behind the scenes assertThat(this.context.getBean(Validator.class)).isEqualTo(defaultValidator); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java index b234e9e64a..8889347e16 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java @@ -61,16 +61,11 @@ class CollectionBinder extends IndexedElementsBinder> { } } - @SuppressWarnings("unchecked") private Collection createNewCollection(Collection additional) { - try { - Collection merged = additional.getClass().newInstance(); - merged.addAll(additional); - return merged; - } - catch (Exception e) { - throw new IllegalStateException("Adding bound values to collection failed."); - } + Collection merged = CollectionFactory + .createCollection(additional.getClass(), additional.size()); + merged.addAll(additional); + return merged; } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java index a0b1aa1a23..cdb7074bf7 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java @@ -119,8 +119,7 @@ class MapBinder extends AggregateBinder> { private ConfigurationPropertyName getEntryName(ConfigurationPropertySource source, ConfigurationPropertyName name) { Class resolved = this.valueType.resolve(); - if (Collection.class.isAssignableFrom(resolved) - || this.valueType.isArray()) { + if (Collection.class.isAssignableFrom(resolved) || this.valueType.isArray()) { return chopNameAtNumericIndex(name); } if (!this.root.isParentOf(name) @@ -130,7 +129,8 @@ class MapBinder extends AggregateBinder> { return name; } - private ConfigurationPropertyName chopNameAtNumericIndex(ConfigurationPropertyName name) { + private ConfigurationPropertyName chopNameAtNumericIndex( + ConfigurationPropertyName name) { int start = this.root.getNumberOfElements() + 1; int size = name.getNumberOfElements(); for (int i = start; i < size; i++) { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java index b35c3c4ab9..4249eef0cd 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java @@ -109,7 +109,17 @@ public final class ConfigurationPropertyName * @return {@code true} if the element is indexed and numeric */ public boolean IsNumericIndex(int elementIndex) { - return isIndexed(elementIndex) && isNumeric(getElement(elementIndex, Form.ORIGINAL)); + return isIndexed(elementIndex) + && isNumeric(getElement(elementIndex, Form.ORIGINAL)); + } + + private boolean isNumeric(CharSequence element) { + for (int i = 0; i < element.length(); i++) { + if (!Character.isDigit(element.charAt(i))) { + return false; + } + } + return true; } /** @@ -401,16 +411,6 @@ public final class ConfigurationPropertyName && element.charAt(length - 1) == ']'; } - private static boolean isNumeric(CharSequence element) { - int length = element.length(); - for (int i = 0; i < length; i++) { - if (!Character.isDigit(element.charAt(i))) { - return false; - } - } - return true; - } - /** * Returns if the given name is valid. If this method returns {@code true} then the * name may be used with {@link #of(CharSequence)} without throwing an exception. diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java index ee48c20e81..17c031aacd 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java @@ -278,7 +278,8 @@ public class CollectionBinderTests { } @Test - public void bindToNonScalarCollectionShouldReturnPopulatedCollection() throws Exception { + public void bindToNonScalarCollectionShouldReturnPopulatedCollection() + throws Exception { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo[0].value", "a"); source.put("foo[1].value", "b"); @@ -287,17 +288,20 @@ public class CollectionBinderTests { Bindable> target = Bindable.listOf(JavaBean.class); List result = this.binder.bind("foo", target).get(); assertThat(result).hasSize(3); - List values = result.stream().map(JavaBean::getValue).collect(Collectors.toList()); + List values = result.stream().map(JavaBean::getValue) + .collect(Collectors.toList()); assertThat(values).containsExactly("a", "b", "c"); } @Test - public void bindToImmutableCollectionShouldReturnPopulatedCollection() throws Exception { + public void bindToImmutableCollectionShouldReturnPopulatedCollection() + throws Exception { MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.values", "a,b,c"); this.sources.add(source); - Set result = this.binder.bind("foo.values", - STRING_SET.withExistingValue(Collections.emptySet())).get(); + Set result = this.binder + .bind("foo.values", STRING_SET.withExistingValue(Collections.emptySet())) + .get(); assertThat(result).hasSize(3); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java index cd4c216d3c..c962c042e1 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java @@ -351,10 +351,10 @@ public class MapBinderTests { withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); Bindable> target = STRING_INTEGER_MAP; this.binder.bind("foo", target, handler); - InOrder inOrder = inOrder(handler); - inOrder.verify(handler).onSuccess(eq(ConfigurationPropertyName.of("foo.bar")), + InOrder ordered = inOrder(handler); + ordered.verify(handler).onSuccess(eq(ConfigurationPropertyName.of("foo.bar")), eq(Bindable.of(Integer.class)), any(), eq(1)); - inOrder.verify(handler).onSuccess(eq(ConfigurationPropertyName.of("foo")), + ordered.verify(handler).onSuccess(eq(ConfigurationPropertyName.of("foo")), eq(target), any(), isA(Map.class)); } @@ -366,27 +366,28 @@ public class MapBinderTests { withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); Bindable> target = STRING_ARRAY_MAP; this.binder.bind("foo", target, handler); - InOrder inOrder = inOrder(handler); + InOrder ordered = inOrder(handler); ArgumentCaptor array = ArgumentCaptor.forClass(String[].class); - inOrder.verify(handler).onSuccess(eq(ConfigurationPropertyName.of("foo.bar")), + ordered.verify(handler).onSuccess(eq(ConfigurationPropertyName.of("foo.bar")), eq(Bindable.of(String[].class)), any(), array.capture()); assertThat(array.getValue()).containsExactly("a", "b", "c"); - inOrder.verify(handler).onSuccess(eq(ConfigurationPropertyName.of("foo")), + ordered.verify(handler).onSuccess(eq(ConfigurationPropertyName.of("foo")), eq(target), any(), isA(Map.class)); } @Test public void bindToMapNonScalarCollectionShouldPopulateMap() throws Exception { Bindable> valueType = Bindable.listOf(JavaBean.class); - Bindable>> target = getMapBindable(String.class, valueType.getType()); + Bindable>> target = getMapBindable(String.class, + valueType.getType()); MockConfigurationPropertySource source = new MockConfigurationPropertySource(); source.put("foo.bar[0].value", "a"); source.put("foo.bar[1].value", "b"); source.put("foo.bar[2].value", "c"); - this.sources - .add(source); + this.sources.add(source); Map> map = this.binder.bind("foo", target).get(); - List values = map.get("bar").stream().map(JavaBean::getValue).collect(Collectors.toList()); + List values = map.get("bar").stream().map(JavaBean::getValue) + .collect(Collectors.toList()); assertThat(values).containsExactly("a", "b", "c"); } @@ -401,9 +402,10 @@ public class MapBinderTests { } @Test - public void bindToMapShouldNotTreatClassWithStringConstructorAsScalar() throws Exception { - this.sources - .add(new MockConfigurationPropertySource("foo.bar.pattern", "1", "line1")); + public void bindToMapShouldNotTreatClassWithStringConstructorAsScalar() + throws Exception { + this.sources.add( + new MockConfigurationPropertySource("foo.bar.pattern", "1", "line1")); Bindable> target = Bindable.mapOf(String.class, Foo.class); Map map = this.binder.bind("foo", target).get(); assertThat(map.get("bar").getPattern()).isEqualTo("1"); @@ -415,18 +417,17 @@ public class MapBinderTests { mockSource.put("foo.bar.baz[0]", "a"); mockSource.put("foo.bar.baz[1]", "b"); mockSource.put("foo.bar.baz[2]", "c"); - this.sources - .add(mockSource); + this.sources.add(mockSource); Map map = this.binder.bind("foo", STRING_ARRAY_MAP).get(); assertThat(map.get("bar.baz")).containsExactly("a", "b", "c"); } @Test - public void bindToMapStringArrayWithDotKeysAndCommaSeparatedShouldPreserveDot() throws Exception { + public void bindToMapStringArrayWithDotKeysAndCommaSeparatedShouldPreserveDot() + throws Exception { MockConfigurationPropertySource mockSource = new MockConfigurationPropertySource(); mockSource.put("foo.bar.baz", "a,b,c"); - this.sources - .add(mockSource); + this.sources.add(mockSource); Map map = this.binder.bind("foo", STRING_ARRAY_MAP).get(); assertThat(map.get("bar.baz")).containsExactly("a", "b", "c"); } @@ -434,13 +435,13 @@ public class MapBinderTests { @Test public void bindToMapStringCollectionWithDotKeysShouldPreserveDot() throws Exception { Bindable> valueType = Bindable.listOf(String.class); - Bindable>> target = getMapBindable(String.class, valueType.getType()); + Bindable>> target = getMapBindable(String.class, + valueType.getType()); MockConfigurationPropertySource mockSource = new MockConfigurationPropertySource(); mockSource.put("foo.bar.baz[0]", "a"); mockSource.put("foo.bar.baz[1]", "b"); mockSource.put("foo.bar.baz[2]", "c"); - this.sources - .add(mockSource); + this.sources.add(mockSource); Map> map = this.binder.bind("foo", target).get(); List values = map.get("bar.baz"); assertThat(values).containsExactly("a", "b", "c"); @@ -449,28 +450,30 @@ public class MapBinderTests { @Test public void bindToMapNonScalarCollectionWithDotKeysShouldBind() throws Exception { Bindable> valueType = Bindable.listOf(JavaBean.class); - Bindable>> target = getMapBindable(String.class, valueType.getType()); + Bindable>> target = getMapBindable(String.class, + valueType.getType()); MockConfigurationPropertySource mockSource = new MockConfigurationPropertySource(); mockSource.put("foo.bar.baz[0].value", "a"); mockSource.put("foo.bar.baz[1].value", "b"); mockSource.put("foo.bar.baz[2].value", "c"); - this.sources - .add(mockSource); + this.sources.add(mockSource); Map> map = this.binder.bind("foo", target).get(); - List values = map.get("bar.baz").stream().map(JavaBean::getValue).collect(Collectors.toList()); + List values = map.get("bar.baz").stream().map(JavaBean::getValue) + .collect(Collectors.toList()); assertThat(values).containsExactly("a", "b", "c"); } @Test public void bindToListOfMaps() throws Exception { Bindable> listBindable = Bindable.listOf(Integer.class); - Bindable>> mapBindable = getMapBindable(String.class, listBindable.getType()); - Bindable>>> target = getListBindable(mapBindable.getType()); + Bindable>> mapBindable = getMapBindable(String.class, + listBindable.getType()); + Bindable>>> target = getListBindable( + mapBindable.getType()); MockConfigurationPropertySource mockSource = new MockConfigurationPropertySource(); mockSource.put("foo[0].a", "1,2,3"); mockSource.put("foo[1].b", "4,5,6"); - this.sources - .add(mockSource); + this.sources.add(mockSource); List>> list = this.binder.bind("foo", target).get(); assertThat(list.get(0).get("a")).containsExactly(1, 2, 3); assertThat(list.get(1).get("b")).containsExactly(4, 5, 6); @@ -479,12 +482,12 @@ public class MapBinderTests { @Test public void bindToMapWithNumberKeyAndCommaSeparated() throws Exception { Bindable> listBindable = Bindable.listOf(String.class); - Bindable>> target = getMapBindable(Integer.class, listBindable.getType()); + Bindable>> target = getMapBindable(Integer.class, + listBindable.getType()); MockConfigurationPropertySource mockSource = new MockConfigurationPropertySource(); mockSource.put("foo[0]", "a,b,c"); mockSource.put("foo[1]", "e,f,g"); - this.sources - .add(mockSource); + this.sources.add(mockSource); Map> map = this.binder.bind("foo", target).get(); assertThat(map.get(0)).containsExactly("a", "b", "c"); assertThat(map.get(1)).containsExactly("e", "f", "g"); @@ -493,12 +496,12 @@ public class MapBinderTests { @Test public void bindToMapWithNumberKeyAndIndexed() throws Exception { Bindable> listBindable = Bindable.listOf(Integer.class); - Bindable>> target = getMapBindable(Integer.class, listBindable.getType()); + Bindable>> target = getMapBindable(Integer.class, + listBindable.getType()); MockConfigurationPropertySource mockSource = new MockConfigurationPropertySource(); mockSource.put("foo[0][0]", "8"); mockSource.put("foo[0][1]", "9"); - this.sources - .add(mockSource); + this.sources.add(mockSource); Map> map = this.binder.bind("foo", target).get(); assertThat(map.get(0)).containsExactly(8, 9); } @@ -512,9 +515,11 @@ public class MapBinderTests { assertThat(map).containsEntry("x [B] y", "[ball]"); } - private Bindable> getMapBindable(Class keyGeneric, ResolvableType valueType) { + private Bindable> getMapBindable(Class keyGeneric, + ResolvableType valueType) { ResolvableType keyType = ResolvableType.forClass(keyGeneric); - return Bindable.of(ResolvableType.forClassWithGenerics(Map.class, keyType, valueType)); + return Bindable + .of(ResolvableType.forClassWithGenerics(Map.class, keyType, valueType)); } private Bindable> getListBindable(ResolvableType type) { @@ -522,6 +527,7 @@ public class MapBinderTests { } public static class Foo { + private String pattern; public Foo() { diff --git a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosPropertiesTests.java b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosPropertiesTests.java index 356b697055..aaac5a8a5b 100644 --- a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosPropertiesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosPropertiesTests.java @@ -85,8 +85,7 @@ public class AtomikosPropertiesTests { assertThat(properties).contains(defaultOf(defaultSettings, "com.atomikos.icatch.max_timeout", "com.atomikos.icatch.default_jta_timeout", - "com.atomikos.icatch.max_actives", - "com.atomikos.icatch.enable_logging", + "com.atomikos.icatch.max_actives", "com.atomikos.icatch.enable_logging", "com.atomikos.icatch.serial_jta_transactions", "com.atomikos.icatch.force_shutdown_on_vm_exit", "com.atomikos.icatch.log_base_name", @@ -111,7 +110,8 @@ public class AtomikosPropertiesTests { private Properties loadDefaultSettings() { try { - Class target = ClassUtils.forName("com.atomikos.icatch.standalone.UserTransactionServiceImp", + Class target = ClassUtils.forName( + "com.atomikos.icatch.standalone.UserTransactionServiceImp", getClass().getClassLoader()); Method m = target.getMethod("getDefaultProperties"); m.setAccessible(true);