Skip to content

Allow test property sources to override command line args #29404

Closed
@philwebb

Description

@philwebb

Whilst working on #29169 we discovered that the inlined test property sources are always added below the commandLineArgs. This is a bit unusual and if they could be added above other property sources our code would be a lot simpler.

We'd like to change the order from this:

SimpleCommandLinePropertySource {name='commandLineArgs'}, 
MapPropertySource {name='Inlined Test Properties'}, 
PropertiesPropertySource {name='systemProperties'}, 
OriginAwareSystemEnvironmentPropertySource {name='systemEnvironment'},
RandomValuePropertySource {name='random'}, 
OriginTrackedMapPropertySource {name='Config resource 'class path resource [application.properties]' via location 'optional:classpath:/''}

To this:

MapPropertySource {name='Inlined Test Properties'}, 
SimpleCommandLinePropertySource {name='commandLineArgs'}, 
PropertiesPropertySource {name='systemProperties'}, 
OriginAwareSystemEnvironmentPropertySource {name='systemEnvironment'},
RandomValuePropertySource {name='random'}, 
OriginTrackedMapPropertySource {name='Config resource 'class path resource [application.properties]' via location 'optional:classpath:/''}

We can't really do this in a patch release, but it seems like something we could do in a minor.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions