Skip to content

Different property resolution if property value is empty #22793

Closed
@renetrefft

Description

@renetrefft

Affects: 5.1.6 / 4.3.23 + Spring Tools 4.2.0

@Component
public class PropertiesTest {

	@Value("${key}")
	String property;

        @Value("${key}")
	String[] propertyArr;
	
}

If a property key is defined without a value in application.properties (i.e. key=) the variable property is initialized with an empty String and propertyArr with an empty String array.

If key is defined without a value in a 'Spring Boot App' Eclipse launch configuration instead ("Override Properties" feature) the start of the application fails:

java.lang.IllegalArgumentException: Could not resolve placeholder 'key' in value "${key}"

Spring should always resolve a property with an empty value as an empty String / String array.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions