February 2015
Intermediate to advanced
178 pages
3h 47m
English
The Environment interface and the PropertySource class were added to Spring 3.1 in order to simplify working with properties. In Spring 3.2, MockEnvironment and MockPropertySource were added to the mock properties in tests. We'll create a program to configure a bean from a properties file value and then mock out the properties file value with MockEnvironment and MockPropertySource.
The following are the steps:
myProp.properties properties file under the test source folder and add the following property:message = I'm the king
@Configuration annotation. The @PropertySource annotation takes the properties' filenames and sets the properties to ...Read now
Unlock full access