From 36d36f97bd95dbb3bab1fdfd40a28975e919571d Mon Sep 17 00:00:00 2001 From: Matt Benson Date: Sun, 5 Jul 2015 22:56:51 -0700 Subject: [PATCH] Improve RandomValuePropertySource Rework RandomValuePropertySource class javadoc, particularly the description of the `random.int` range suffix. Also add support for range based random longs. Fixes gh-3391 --- .../config/RandomValuePropertySource.java | 81 +++++++++++++++---- .../RandomValuePropertySourceTests.java | 18 ++++- 2 files changed, 82 insertions(+), 17 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/RandomValuePropertySource.java b/spring-boot/src/main/java/org/springframework/boot/context/config/RandomValuePropertySource.java index 178b3bbda3d..afce9bb5abd 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/RandomValuePropertySource.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/RandomValuePropertySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2015 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. @@ -28,13 +28,31 @@ import org.springframework.util.StringUtils; /** * {@link PropertySource} that returns a random value for any property that starts with - * {@literal "random."}. Return a {@code byte[]} unless the property name ends with - * {@literal ".int} or {@literal ".long"}. + * {@literal "random."}. Where the "unqualified property name" is the portion of the + * requested property name beyond the "random." prefix, this {@link PropertySource} + * returns: + *