After setting a prefix for System Environment Propterties (SpringBoot 2.5) application fails to start
Describe the bug After setting a configuration prefix for the system environment properties, then the application fails to start and complains about the prefix not being valid. This is a new feature of Spring Boot 2.5
Description: Failed to bind properties under 'spring.cloud.inetutils' to org.springframework.cloud.commons.util.InetUtilsProperties: Reason: org.springframework.boot.context.properties.source.InvalidConfigurationPropertyNameException: Configuration property name 'WS' is not valid
Action: Update your application's configuration
Sample
@SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication application = new SpringApplication(Application.class); application.setEnvironmentPrefix("WS"); application.run(args); } }
Same problem here...
SpringBoot: 2.5.6 SpringCloud: 2020.0.4
Tested the same code with new releases and still having the same error:
SpringBoot: 2.6.1 SpringCloud: 2021.0.0
Testing with the following version, the error message has changed:
Canonical names should be kebab-case ('-' separated), lowercase alpha-numeric characters and must start with a letter
Changing the prefix to lowercase works fine:
application.setEnvironmentPrefix("ws");
SpringBoot: 2.7.5 SpringCloud: 2021.0.4
reopened by mistake, sorry