I\'m using Spring Boot example to read the following from the properties file.
sub.region.data={\\
AF: {\'subRegionCd\' : \'34\', \'subR
Looks like you made a mistake after 'subRegionDesc',, I think you mean using colon, not a comma here
With spring boot I suggest you to use ConfigurationProperties, instead of @Value.
For example, in this case you have to:
put @EnableConfigurationProperties(SubRegionConfig.class) to one of your spring configuration class.
Create config class:
@ConfigurationProperties(prefix = "sub.region")
public static class SubRegionConfig {
private Map data;
//getters and setters
}
Use .yml instead of .properties, like that:
sub:
region:
data:
AF:
subRegionCd: '34'
subRegionName: 'Southern Asia'
subRegionDesc: ''
subRegionStatus: 'A'
After that you can get every properties you want from SubRegionConfing
@Autowired
private SubRegionConfig subRegionConfig;
ConfigurationsProperties is more complex, but more flexible and preferrable to use in most cases.