Spring Boot @ServiceConnection Example

Spring Boot 3.1 introduced @ServiceConnection to enable the Spring Boot’s auto-configuration to use the service connection details to connect to a remote service (Testcontainers). Tables of contents: 1. Testing with @DynamicPropertySource 2. Spring Boot 3.1 and @ServiceConnection 3. Download Source Code 4. References 1. Testing with @DynamicPropertySource The following example uses @DynamicPropertySource to register the …

Read more

Spring Boot @DynamicPropertySource Example

In Spring Boot, we can use @DynamicPropertySource to dynamically register or override property values in the ApplicationContext for integration tests. Tables of contents: 1. Testing with ApplicationContextInitializer 2. Testing with @DynamicPropertySource 3. Testing with Spring Boot 3.1 and @ServiceConnection 4. Download Source Code 5. References P.S. The @DynamicPropertySource feature is available from Spring Framework 5.2.5 …

Read more