Announcement Announcement Module
No announcement yet.
default values with PropertyPlaceholderConfigurer Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • default values with PropertyPlaceholderConfigurer

    Hey everyone,

    I'm using the PropertyPlaceholderConfigurer to allow configuration of the some properties like jdbc connection information, mail server settings, etc. to be configured from a properties file. The thing is that if a property is not set in the properties file an admin creates I'd like to try and use a reasonable default. For instance, I'm also allowing some configuration of hibernate, such as the dialect, and it would be nice to put other properties in there as well, like show_sql,, cglib.use_reflection_optimizer, etc. But if those values don't appear I'd like to default to something reasonable. How can I do that? Any ideas?


  • #2
    You can either set multiple properties files to the "locations" property of the PropertyPlaceholderConfigurer, or hardcode the default values in the "properties" property, or use org.springframework.beans.factory.config.PropertyO verrideConfigurer.