Skip to content

Support command line arguments with an empty value #24464

@robwruck

Description

@robwruck

With Spring Boot, you can override application properties using command line arguments like so:

java -jar my-boot.jar --my.property.name=value

This, however, fails when you try to pass an empty value:

java -jar my-boot.jar --my.property.name=
java.lang.IllegalArgumentException: Invalid argument syntax: --my.property.name=
  at org.springframework.core.env.SimpleCommandLineArgsParser.parse(SimpleCommandLineArgsParser.java:75)
  at org.springframework.core.env.SimpleCommandLinePropertySource.<init>(SimpleCommandLinePropertySource.java:90)

Since an empty string is a legal value for an application property, there seems to be no good reason to reject command line arguments with an empty value.

A real-world example is Kafka's ssl.endpoint.identification.algorithm which has to be set to an empty string to disable host name verification.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: feedback-providedFeedback has been providedtype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions