Announcement Announcement Module
Collapse
No announcement yet.
Properties dynamic reload Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 ?

  • #2
    It depends... What properties are you thinking about here?

    Comment


    • #3
      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.

      Comment


      • #4
        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?

        Comment


        • #5
          For I18N it is already possible. Simply define a ReloadableResourceMessageSource. For further (runtime) configuration is going to be hard I guess.

          Comment


          • #6
            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 ...

            Comment

            Working...
            X