• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to create and access properties without a properties file or class

 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was browsing through the web and i came accross this:


You can also configure a java.util.Properties instance as:

The Spring container converts the text inside the <value/> element into a java.util.Properties instance by using the JavaBeans PropertyEditor mechanism. This is a nice shortcut, and is one of a few places where the Spring team do favor the use of the nested <value/> element over the value attribute style.


source : http://static.springsource.org/spring/docs/3.0.0.RC1/spring-framework-reference/html/ch03s04.html#beans-value-element


From what i understand, these are properties created without the use of properties file,
I tried to do the same:


and I tried to access in the following ways:
${myMappings.properties.myVariable}
Error: Could not resolve placeholder 'myMappings.properties.myVariable'

${myMappings.myVariable}
Error: Could not resolve placeholder 'myMappings.myVariable'

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try just myVariable. Since that is the name of your property.

Mark
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I feel silly to have not tried that,
but it didnt work too:)

${myVariable}
Could not resolve placeholder 'myVariable'
 
reply
    Bookmark Topic Watch Topic
  • New Topic