Spring Could not Resolve placeholder
You are not reading the properties file correctly. The propertySource should pass the parameter as: file:appclient.properties
or classpath:appclient.properties
. Change the annotation to:
@PropertySource(value={"classpath:appclient.properties"})
However I don't know what your PropertiesConfig
file contains, as you're importing that also. Ideally the @PropertySource
annotation should have been kept there.
If you are using Spring 3.1 and above, you can use something like...
@Configuration
@PropertySource("classpath:foo.properties")
public class PropertiesWithJavaConfig {
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}
You can also go by the xml configuration like...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:property-placeholder location="classpath:foo.properties" />
</beans>
In earlier versions.