2

It is possible to use the @Value annotation with a Spring PropertyPlaceholderConfigurer?

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
      p:location="classpath:application-test.properties"
/>

The <util:properties id="appProperties" location="classpath:application-test.properties" /> works correct with @Value but i would like to use 1 way of configuring. Now i have the both of them pointing towards the same property file.

Marco
  • 15,101
  • 33
  • 107
  • 174
  • Hmm, I should have posted my solution (http://stackoverflow.com/a/41884089/5290465) here. – 6324 Jan 26 '17 at 22:56

1 Answers1

3

You do not need to use a PropertyPlaceholderConfigurer if you have already setup util:properties. In your bean config, create the util:properties bean and then within your classes annotate like

@Value("#{myProps.someProperty}")

http://forum.springsource.org/showthread.php?69602-Value-and-PropertyPlaceholderConfigurer

Kevin Bowersox
  • 93,289
  • 19
  • 159
  • 189
  • 3
    But is it possible to use only PropertyPlaceHolderConfigurer? I need that to replace stuff in my applicationContext.xml, so i need the PropertyPlaceHolderConfigurer. – Marco Jul 04 '11 at 10:39