Can anyone please help with this? I have a requirement to set default values of properties spring.jpa.hibernate.ddl-auto=none and spring.jpa.generate-ddl=false from the application so even after changing from the properties file values should not change not perform DDL operation. Basically, I have to prevent DDL operation.
Thank you.
I have tried setting like this but still, these properties are applicable from yml. when I am setting values properties file it is performing DDL operation.
@SpringBootApplication
public class Main {
public static void main(String[] args) {
SpringApplication springApplication = new SpringApplication(Main.class);
Map<String, Object> properties = new HashMap<>();
properties.put("spring.jpa.hibernate.ddl-auto", "none");
properties.put("spring.jpa.generate-ddl", false);
springApplication.setDefaultProperties(properties);
springApplication.run(args);
}
}
YAML file
spring:
jpa:
generate-ddl: true
hibernate:
ddl-auto: create