@SpringBootApplication
@EntityScan("com.${test}")
public class EntityScanExampleApplication {
public static void main(String[] args) {
SpringApplication.run(EntityScanExampleApplication.class, args);
}
}
test=value
For code above, in Spring Boot 2.4 entityscan.getPackageNames()
returns com.${test}
.
Worked in Spring Boot 2.3 and before.
Project to reproduce and check with 2.3: https://github.com/tjuchniewicz/spring-boot-entityscan-issue
Comment From: wilkinsona
Thanks for the report. To my knowledge, we have never intentionally supported placeholders in @EntityScan
. We certainly don't have a test for it anyway. The change in behaviour is due to the changes that we made for https://github.com/spring-projects/spring-boot/issues/22318. Moving away from reflection has meant that the constructor arguments no longer go through placeholder resolution.
Flagging for team attention to see if we want to reinstate the old behaviour and discuss how best to do that without regressing #22318.
Comment From: wilkinsona
As @mbhave noted in #25415, @ComponentScan
supports placeholders so we think it makes sense to reinstate @EntityScan
's support for placeholders.