Skip to content

Add "ignoreResourceNotFound" attribute to the @PropertySource [SPR-10932] #15560

@spring-projects-issues

Description

@spring-projects-issues

Mattias Severson opened SPR-10932 and commented

Currently, a file is required to exist if it is added to the @PropertySource annotation. If the application already has the properties it needs, it should be possible to launch it without the associated file being present:

@PropertySource(value = {"classpath:/com/example/optional.properties"}, ignoreResourceNotFound = true)

or

@PropertySource(value = {"classpath:/com/example/mandatory.properties", "classpath:/com/example/optional.properties"}, ignoreResourceNotFound = true)

With repeating annotations in Java 8, it should be possible to add the same annotation multiple times:

@PropertySource(value = {"classpath:/com/example/mandatory.properties"})
@PropertySource(value = {"classpath:/com/example/optional.properties"}, ignoreResourceNotFound = true)

Related information:


Affects: 3.2.4

Issue Links:

1 votes, 4 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issuetype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions