Please, refer to https://github.com/spring-cloud/spring-cloud-config/issues/2376 and https://github.com/spring-projects/spring-boot/issues/39940
We use custom EnvironmentPostProcessor and set spring.config.import property in it. After upgrading to Spring Boot from 3.1.5 to 3.2.0, this functionality was broken so that properties from application.yml or application.properties are not read.
Can you check the case?
-
Take the attached Demo application: demo.zip
-
Build and run DemoApplicationTests
- You will see the message ""myProperty value is not specified from application.yml"
- Comment
# org.springframework.boot.env.EnvironmentPostProcessor=com.example.demo.BeforeDataLoaderEnvironmentPostProcessor
in spring.factories file
- Run DemoApplicationTests and you will see the message
**** myProperty: foo
Previously we didn't have such an issue and got properties' values from application .yml , .properties in both cases.
Comment From: wilkinsona
The sample does not compile. It's referencing jakarta.validation classes in MyConfigProperties but does not depend on the Bean Validation API. It also appears to be using a mixture of JUnit 4 and JUnit 5 and has both an application.yml and application.yaml which is adding unnecessary complexity.
Can you please tidy things up and reduce them to the bare minimum that's required to reproduce the problem?
Comment From: anvo1115
Please, check this version: demo.zip
Comment From: wilkinsona
Thanks, the sample compiles now. Unfortunately, it doesn't reproduce the behaviour that you have described as both 3.1.5 and 3.2.x output myProperty value is not specified from application.yml. Here's the output from 3.1.5:
**** myProperty: default-value
myProperty value is not specified from application.yml
**** myProperty: default-value
myProperty value is not specified from application.yml
**** myProperty: default-value
myProperty value is not specified from application.yml
**** myProperty: default-value
myProperty value is not specified from application.yml
**** myProperty: default-value
myProperty value is not specified from application.yml
**** myProperty: default-value
myProperty value is not specified from application.yml
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.1.5)
Please update the sample such that it works with Spring Boot 3.1.x and does not work with 3.2.x.
Comment From: anvo1115
Yes, I was wrong. I checked again. It seems that the fix for https://github.com/spring-cloud/spring-cloud-config/issues/2376 didn't fix my issue. You can close the ticket.