Spring @Value escape colon(:) in default value

Update: For spring 4.2 and higher, no single quotes are needed. Spring will see the first colon as special, and use all the rest as a single string value. For spring 4.2 and higher, @Value(“${prop.url:http://myurl.com}”) For the previous versions, I believe single quotes will do the trick: @Value(“${prop.url:’http://myurl.com’}”)

Spring Boot access static resources missing scr/main/resources

Just use Spring type ClassPathResource. File file = new ClassPathResource(“countries.xml”).getFile(); As long as this file is somewhere on classpath Spring will find it. This can be src/main/resources during development and testing. In production, it can be current running directory. EDIT: This approach doesn’t work if file is in fat JAR. In such case you need … Read more

Spring @Value is not resolving to value from property file

I also found the reason @value was not working is, @value requires PropertySourcesPlaceholderConfigurer instead of a PropertyPlaceholderConfigurer. i did the same changes and it worked for me, i am using spring 4.0.3 release. I configured this using below code in my configuration file – @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)