diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java index 37c17f8b214..e7bc44effab 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2016 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. @@ -259,6 +259,7 @@ public class PropertiesConfigurationFactory if (this.conversionService != null) { dataBinder.setConversionService(this.conversionService); } + dataBinder.setAutoGrowCollectionLimit(Integer.MAX_VALUE); dataBinder.setIgnoreNestedProperties(this.ignoreNestedProperties); dataBinder.setIgnoreInvalidFields(this.ignoreInvalidFields); dataBinder.setIgnoreUnknownFields(this.ignoreUnknownFields); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java index 839ec10fb74..46b3a25f1e4 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2016 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. @@ -210,6 +210,19 @@ public class EnableConfigurationPropertiesTests { assertEquals(2, this.context.getBean(TestProperties.class).getList().size()); } + @Test + public void testCollectionPropertiesBindingWithOver256Elements() { + this.context.register(TestConfiguration.class); + List pairs = new ArrayList(); + pairs.add("name:foo"); + for (int i = 0; i < 1000; i++) { + pairs.add("list[" + i + "]:" + i); + } + EnvironmentTestUtils.addEnvironment(this.context, pairs.toArray(new String[] {})); + this.context.refresh(); + assertEquals(1000, this.context.getBean(TestProperties.class).getList().size()); + } + @Test public void testPropertiesBindingWithoutAnnotation() { this.context.register(InvalidConfiguration.class);