Merge pull request #13950 from zahikhan/master

Spring Boot Properties Prefix Must Be in Canonical Form
This commit is contained in:
Vini 2023-05-08 10:47:39 +02:00 committed by GitHub
commit f38b976997
3 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,12 @@
package com.baeldung.error;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class KebabCasingDemoApplication {
public static void main(String[] args) {
SpringApplication.run(KebabCasingDemoApplication.class, args);
}
}

View File

@ -0,0 +1,18 @@
package com.baeldung.error.configuration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "profile.profileProperties")
public class MainConfiguration {
private String name;
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
}

View File

@ -32,3 +32,12 @@ environment.name=${OS}
java.home.and.environment=${JAVA_HOME}+${OS} java.home.and.environment=${JAVA_HOME}+${OS}
not.existing.system.property=${thispropertydoesnotexist} not.existing.system.property=${thispropertydoesnotexist}
baeldung.presentation=${HELLO_BAELDUNG}. Java is installed in the folder: ${JAVA_HOME} baeldung.presentation=${HELLO_BAELDUNG}. Java is installed in the folder: ${JAVA_HOME}
#---
#camelCasing
#profile.applicationProperties.name="Baeldung"
#PascalCasing
#profile.ApplicationProperties.name="Baeldung"
#SnakingCasing
#profile.application_properties.name="Baeldung"
#KebabCasing
profile.application-properties.name="Baeldung"