I'm encountering an issue with my Spring application in Java 17, and I'm getting the error message "Could not resolve placeholder 'spring.jpa.hibernate.ddl-auto' in value "${spring.jpa.hibernate.ddl-auto}". I've checked my configuration, but I can't seem to figure out why this is happening. Can someone help me troubleshoot this problem?
Configuration: Here's the relevant part of my application-dev.properties file: *spring.jpa.hibernate.ddl-auto=create *
Application Context: My application context is configured to scan for properties using the @PropertySource annotation in my main configuration class.
Troubleshooting Steps: I've already checked the property file location, verified that the property key is spelled correctly, and tried to rebuild and restart my application, but I'm still encountering this error.
Can someone help me identify why this placeholder is not being resolved and suggest potential solutions to fix this issue? Any assistance would be greatly appreciated!
Checked the application-dev.properties file to ensure that the spring.jpa.hibernate.ddl-auto property is correctly defined as follows: spring.jpa.hibernate.ddl-auto=create
Verified that my DevConfig class (which is annotated with @Configuration and @PropertySource) correctly configures the property source:
@Configuration
@Profile("dev")
@PropertySource(value={"classpath:application-dev.properties"})
public class DevConfig {
@Autowired
private DBService dbService;
@Value("${spring.jpa.hibernate.ddl-auto}")
private String ddlAuto;
@Bean
public boolean instanciaDB() {
if ("create".equals(ddlAuto)) { // Compare the value directly
dbService.instanciaDB();
}
return false;
}
}