Код: Выделить всё
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
@TestConfiguration
@PropertySource("classpath:/test.properties") // This is the problematic line
@EnableConfigurationProperties
@ContextConfiguration(classes = {...})
@ComponentScan(basePackageClasses = ...)
@Slf4j
public class TestBase {
...
}
Решение, какой из них использовать, может быть таким же простым, как проверка системы или Переменная среды существует или нет.
Может кто-нибудь помочь мне, как я могу заставить эту работу работать как на локальном, так и на CI-окружении, загрузив тем или иным способом один и тот же файл конфигурации?
Подробнее здесь: https://stackoverflow.com/questions/792 ... on-conditi