Results 1 to 6 of 6

Thread: Properties dynamic reload

  1. #1
    Join Date
    Sep 2005
    Posts
    18

    Default Properties dynamic reload

    Hi,

    I'd like to know if there are facilities in Spring right now - or planned ones - for automatic reload of modified properties file.

    I think it would be a great - at least for me - feature, especially for server based applications, like webapps because of the tedious shutdown/restart cycle you have to do when modifying properties in such files.

    Of course, there are caveats, like the fact that often a property file contains properties for more than one bean and thus if this file is modified, the container would try to reinject all the properties, even if they are unchanged.

    So there would be a simple cache preventing the reinjection if not needed.

    Does such a thing exist or is planned ?
    People saying it cannot be done should not interrupt people doing it - Chinese proverb

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    It depends... What properties are you thinking about here?
    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
    Join Date
    Sep 2005
    Posts
    18

    Default

    Quote Originally Posted by mdeinum View Post
    It depends... What properties are you thinking about here?
    Well, properties like l10n for web frameworks, for example. Or jobs related properties, like file paths.

    There are many cases where it would be fancy.

    I was thinking about selecting which properties could be reloaded and which couldn't, because, as I said, there are properties you clearly don't want to change on-the-fly 'cause they are sensible - for any reason. The selection system could behave on a filename based rule or on properties name, with inclusion and/or exclusion, etc ...

    Also, the system would perform dirty-checking to check if a property really need to be changed. But since properties are String's, this would, at first glance, only be a Map<String, String> checking the content of the values based on properties name (as keys).

    Clearly, this kind of system would be nice, especially in development and test environment; but it wouldn't be wise to use it in production environment.

    Maybe a system like this already exists, but I couldn't find one when googling.
    People saying it cannot be done should not interrupt people doing it - Chinese proverb

  4. #4
    Join Date
    Sep 2004
    Posts
    1,086

    Default

    Frankly, I can't imagine how would it work in a general case. Most of the Spring wired classes are written based on the assumption that the configuration never changes, that the afterPropertiesSet is executed exactly once. What do you do about factories? Constructor DI?

  5. #5
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    For I18N it is already possible. Simply define a ReloadableResourceMessageSource. For further (runtime) configuration is going to be hard I guess.
    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

  6. #6
    Join Date
    Sep 2005
    Posts
    18

    Default

    It was simply an idea... I'm sure I'm not the one who thought about it.
    At first glance it didn't seem to be so hard to do, but you're right dejanp, I haven't thought about the problems you raised.
    Nevermind ...
    People saying it cannot be done should not interrupt people doing it - Chinese proverb

Posting Permissions

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