org.springframework.boot.env

Class RandomValuePropertySource



  • public class RandomValuePropertySource
    extends PropertySource<Random>
    PropertySource that returns a random value for any property that starts with "random.". Where the "unqualified property name" is the portion of the requested property name beyond the "random." prefix, this PropertySource returns:
    • When "int", a random Integer value, restricted by an optionally specified range.
    • When "long", a random Long value, restricted by an optionally specified range.
    • Otherwise, a byte[].
    The "random.int" and "random.long" properties supports a range suffix whose syntax is:

    OPEN value (,max) CLOSE where the OPEN,CLOSE are any character and value,max are integers. If max is provided then value is the minimum value and max is the maximum (exclusive).

    Author:
    Dave Syer, Matt Benson