I am trying to run spring -test cases using spring-boot. My test class is as follows
@ContextConfiguration(initializers = TestContextInitializer.class)
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {TestServiceApplication.class})
public class SampleTest {
@org.junit.Test
public void getContactsByName() throws Exception {
}
}
So far, my configuration class looks like
public class TestContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
@Override
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
System.setProperty("DATA_DB_URL","some_url");
System.setProperty("DATA_DB_USER","some_user");
System.setProperty("DATA_DB_PASSWORD","some_password");
System.setProperty("DATA_DB_POOL_SIZE","2");
System.setProperty("DATA_DB_ROW_PREFETCH_SIZE","50");
}
}
Everything is working fine, but I have problems. I cannot register PASSWORD in the source code as my company policy. How can I export the password so that I do not need to verify it.
source
share