Results 1 to 6 of 6

Thread: Reading properties from database

  1. #1

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    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
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    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

  4. #4
    Join Date
    Mar 2007
    Posts
    515

    Default

    Quote 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.

  5. #5

    Default

    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.

  6. #6
    Join Date
    Aug 2007
    Posts
    2

    Default

    @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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •