Package org.springframework.boot.env
Class RandomValuePropertySource
- java.lang.Object
- org.springframework.core.env.PropertySource<Random>
- org.springframework.boot.env.RandomValuePropertySource
public class RandomValuePropertySource extends org.springframework.core.env.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, thisPropertySource
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[]
.
OPEN value (,max) CLOSE
where theOPEN,CLOSE
are any character andvalue,max
are integers. Ifmax
is provided thenvalue
is the minimum value andmax
is the maximum (exclusive).- When "int", a random
Field Summary
Fields Modifier and Type Field Description static String
RANDOM_PROPERTY_SOURCE_NAME
Name of the randomPropertySource
.
Constructor Summary
Constructors Constructor Description RandomValuePropertySource()
RandomValuePropertySource(String name)
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment)
Object
getProperty(String name)
Field Detail
RANDOM_PROPERTY_SOURCE_NAME
public static final String RANDOM_PROPERTY_SOURCE_NAME
Name of the randomPropertySource
.- See Also:
- Constant Field Values
Constructor Detail
RandomValuePropertySource
public RandomValuePropertySource(String name)
RandomValuePropertySource
public RandomValuePropertySource()
Method Detail
getProperty
public Object getProperty(String name)
- Specified by:
getProperty
in classorg.springframework.core.env.PropertySource<Random>
addToEnvironment
public static void addToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment)