I ask the same question that I asked here because the answers provided in it do not solve my problem.
I am using Spring 4.1.3 in a Spring MVC web application. I have a JPA bean object containing a field:
@DateTimeFormat(pattern = "${date.format}")
private LocalDate certifiedOn;
I would like the template to be entered based on the key in the properties file. This should work in Spring starting with version 3.0.3 , however the binding does not work in the controller since Pattern includes reserved character '{'.
I know that I am successfully reading my properties file, as the application uses other properties. Here is how I set this setting through javaConfig:
@Configuration
@ComponentScan(basePackages = "com")
@PropertySource("classpath:spring.properties")
public class AppConfig {
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
...
}
The root directory of the path contains the file spring.properties:
date.format = yyyy-MM-dd
What am I missing here so that this does not help?