Giriş
Şu satırı dahil ederiz
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
Açıklaması şöyle
The @ServiceConnection removes the need to write @DynamicPropertySource property overrides.
Örnek
Şöyle yaparız
@SpringBootTestpublic class ServiceConnectionFieldTest {@Container@ServiceConnectionstatic PostgreSQLContainer postgres = new PostgreSQLContainer(DockerImageName.parse("postgres:15.1")).withUsername("testUser").withPassword("testSecret").withDatabaseName("testDatabase");@BeforeAllstatic void setup(){postgres.start();}...}
@RestartScope Anotasyonu
Giriş
Şu satırı dahil ederiz
import org.springframework.boot.devtools.restart.RestartScope;
Örnek -
Açıklaması şöyle
annotation which prevents the container restarts during automatic reloads by Spring Boot DevTools.
Hiç yorum yok:
Yorum Gönder