spring-cloud-commons icon indicating copy to clipboard operation
spring-cloud-commons copied to clipboard

After setting a prefix for System Environment Propterties (SpringBoot 2.5) application fails to start

Open jdeex opened this issue 4 years ago • 2 comments

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); } }

jdeex avatar Oct 05 '21 19:10 jdeex

Same problem here...

SpringBoot: 2.5.6 SpringCloud: 2020.0.4

ticoaraujo avatar Nov 03 '21 14:11 ticoaraujo

Tested the same code with new releases and still having the same error:

SpringBoot: 2.6.1 SpringCloud: 2021.0.0

jdeex avatar Dec 16 '21 13:12 jdeex

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

jdeex avatar Oct 27 '22 11:10 jdeex

reopened by mistake, sorry

jdeex avatar May 18 '23 09:05 jdeex