Announcement Announcement Module
Collapse
No announcement yet.
Reading properties from database Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading properties from database

    Hi ,
    Our application has many property files due to extensibility and becomes a nightmare managing them. I would like to know if there is any suggestion about how I could unify all the properties into a database (obviously excluding the database connection properties). This way, managing it can be easy by snapping a UI on top of the database table containing the properties. This is what I would like to know:
    1. How can I direct my propertyplaceholderconfiguration class to load the properties from database based on a query?
    2. Once it is loaded, obviously, one of the advantages is that we would be able to update the database without shutting down the server. How can I propogate the new changes to my beans already referencing the properties without restart?
    3. I would not like to be hitting the database all times for getting the properties, so will it be cached and if so, how can I specify the time to live?

    Any help greatly appreciated!

    Anoop

  • #2
    1) Read the properties from a database and simply pass them to the PropertyPlaceHolderConfigurer. (Examples can be found on the forum)
    2) You cannot, the context is static
    3) As the context is static this is only going to happen once

    Comment


    • #3
      Thank you, but could you please elaborate?
      1. Would appreciate if you could provide the link to the forum that has this example.
      2. The context would be static, I agree, but couldnt we refresh the applicationcontext and wouldnt that get the fresh properties from the database? (AbstractApplicationContext#refresh())
      3. This I agree does not tie very well.

      Anoop

      Comment


      • #4
        Originally posted by anoop2811 View Post
        Thank you, but could you please elaborate?
        1. Would appreciate if you could provide the link to the forum that has this example.
        Try google before asking! The first result looks like a solution.

        Comment


        • #5
          Andrie, thanks for sharing the same minus the sarcasm (if there was none, please forgive). I did find that post earlier, but as you can see that it is a 6 year old solution. What I wanted to know is if the latest release of spring has any solution out of the box. If not, as you suggested, that post has a possible solution. Thanks.

          Comment


          • #6
            @anoop2811
            Could you post your solution?
            What would be a possible solution to access the stored properties from my applicationContext.xml?I need to access, for example, the ldap url property to set LdapContextSource within my applicationContext.xml.

            Comment

            Working...
            X