I'm working on a Spring Framework project and recently upgraded the Java SDK from 11 to 17. After upgrading to Java 17, everything worked fine — the project built successfully, deployed without issues, and ran properly in production.
However, while working locally with Java SDK 11, I tried running the same project and encountered the following error:
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.test.commerce.front.controller.etc.CommerceController];
nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.profiles.active' in value "classpath:commerce-ec-${spring.profiles.active}.properties"
This error points to a line in my configuration class using @PropertySource:
@PropertySource("classpath:commerce-ec-${spring.profiles.active}.properties")
Switching back to Java 17 and rebuilding resolves the issue, and the application starts without any problem. I initially thought this might be a local environment issue, but I tested the same behavior on our development server — and it fails the same way with Java 11.
I couldn’t find any documentation or references indicating that placeholder resolution behavior for @PropertySource differs between Java versions. Is there any known difference in how Spring handles property resolution with @PropertySource between Java 11 and Java 17?
Any insight would be appreciated.