BAEL-7523: upgrade to SB 3.x

This commit is contained in:
emanueltrandafir1993 2024-02-21 08:40:49 +01:00 committed by emanuel.trandafir
parent e659b2fbfd
commit b9ee399220
4 changed files with 46 additions and 20 deletions

View File

@ -6,9 +6,10 @@
<artifactId>spring-boot-libraries-3</artifactId>
<parent>
<artifactId>spring-boot-modules</artifactId>
<groupId>com.baeldung.spring-boot-modules</groupId>
<version>1.0.0-SNAPSHOT</version>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-3</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-boot-3</relativePath>
</parent>
<dependencies>
@ -19,7 +20,6 @@
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
<version>${spring-kafka.version}</version>
</dependency>
<dependency>
@ -32,18 +32,14 @@
<artifactId>spring-modulith-events-kafka</artifactId>
<version>${spring-modulith-events-kafka.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
@ -69,14 +65,16 @@
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<artifactId>oracle-xe</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@ -90,10 +88,11 @@
<properties>
<java.version>17</java.version>
<spring-modulith-events-kafka.version>1.1.3</spring-modulith-events-kafka.version>
<testcontainers.version>1.19.6</testcontainers.version>
<spring-boot.version>3.1.5</spring-boot.version>
<spring-modulith-events-kafka.version>1.1.2</spring-modulith-events-kafka.version>
<testcontainers.version>1.19.3</testcontainers.version>
<awaitility.version>4.2.0</awaitility.version>
<spring-kafka.version>3.1.2</spring-kafka.version>
</properties>
</project>
</project>

View File

@ -10,3 +10,9 @@ spring.kafka:
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
auto-offset-reset: earliest
spring.modulith:
events:
republish-outstanding-events-on-startup: true
jdbc.schema-initialization.enabled: true

View File

@ -0,0 +1,13 @@
package com.baeldung.springmodulith.events.externalization;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ApplicationUnitTest {
@Test
void contextLoads() {
}
}

View File

@ -12,6 +12,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.containers.OracleContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.shaded.org.awaitility.Awaitility;
@ -35,13 +36,20 @@ class EventsExternalizationLiveTest {
@Container
static KafkaContainer kafkaContainer = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:latest"));
@Container
static OracleContainer oracleContainer = new OracleContainer("gvenzl/oracle-xe:21-slim-faststart")
.withDatabaseName("test")
.withUsername("user")
.withPassword("pass");
@DynamicPropertySource
static void dynamicProperties(DynamicPropertyRegistry registry) {
registry.add("spring.kafka.bootstrap-servers", kafkaContainer::getBootstrapServers);
registry.add("spring.datasource.url", oracleContainer::getJdbcUrl);
}
static {
Awaitility.setDefaultTimeout(ofSeconds(3));
Awaitility.setDefaultTimeout(ofSeconds(5));
Awaitility.setDefaultPollDelay(ofMillis(100));
}