Şöyle yaparız.
public class DatabasePropertiesEnvPostProcessor implements
EnvironmentPostProcessor {
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment,
SpringApplication application) {
Properties props = new Properties();
props.put("spring.datasource.url", "<my value>");
environment.getPropertySources().addFirst(
new PropertiesPropertySource("dbProps", props));
}
}
spring.factories dosyasına şu satırı ekleriz.org.springframework.context.ApplicationListener=com.DatabasePropertiesListener
Hiç yorum yok:
Yorum Gönder