Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-10325

Allow for ignoreResourceNotFound on @PropertySource

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 3.2.1
    • Fix Version/s: 4.0 GA
    • Component/s: Core:Environment
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      It doesn't appear to be possible to set up @PropertySource annotations that refer to non-existent files.

      It can be quite useful to allow for optional configuration files, for example, ~/.application/application.properties to allow for the optional overriding of configuration properties on a per user basis. I might not have the file, but if I do, it's values should override the defaults.

      It is possible to achieve this behaviour with 'setIgnoreResourceNotFound' on the PropertyPlaceholderConfigurer, but the new @PropertySource annotation will throw a FileNotFoudException and the application context fails to start.

      Consider adding an attribute to @PropertySource to allow for this behaviour, and potentially a @PropertySources annotation which can be configured with an array of @PropertySource values to allow for file configuration on a per file basis.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                juergen.hoeller Juergen Hoeller
                Reporter:
                wesleyhall Wesley Hall
                Last updater:
                Juergen Hoeller
              • Votes:
                11 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 22 weeks, 2 days ago