Hi,
I am developing a simple web application using spring mvc. I am struggling to inject a property from a properties file to a field in Controller class. The changes I have done are:
in root-context.xml:
in servlet-context.xml:Code:<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath*:/config/env/env.properties</value> </list> </property> <property name="ignoreUnresolvablePlaceholders" value="true"/> </bean>
I am able to get the basic flow working from jsp to controller and back. But If I try to inject some property in the controller, it fails:Code:<context:component-scan base-package="...file.web"/>
orCode:@Value("#{propertyConfigurer.outputFilePath}") private String outputFilePath;
Kindly help me inject some property value using annotationCode:@Value("#{propertyConfigurer['outputFilePath']}") private String outputFilePath;


Reply With Quote