Skip to content

@ConfigurationProperties prefix with capital letters causes fail #9545

@ctwoolsey

Description

@ctwoolsey

I discovered this in trying to upgrade from Spring boot 1.4.1 to 2.0.0.M2

If I have a yaml file with the following:
myProperties: name: 'Sam'

and I have a configuration class:

@Configuration
@ConfigurationProperties(prefix="myProperties")
public class MyConfig {
	private String name;
	
	public String getName(){
		return name;
	}
	
	public void setName(String name){
		this.name =  name;
	}
	
}

I will get a bunch of errors trying to create the MyConfig bean. Essentially the error boils down to:

Caused by: java.lang.IllegalArgumentException: Configuration property name 'myProperties' is not valid

I notice that if I change this line to:
@ConfigurationProperties(prefix="myproperties")

the error goes away. Using a prefix with capital letters in it used to work in 1.4.1 and 1.5.4

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions