Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/cicd-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: Set up JDK 21
uses: actions/setup-java@v2
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'adopt'
distribution: 'zulu'

- name: Build with Gradle
run: ./gradlew clean build --parallel
run: ./gradlew clean build

- name: Quarkus Native Image Test
run: ./gradlew :quarkus-app:testNative
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import bitxon.dropwizard.errorhandler.ResourceNotFoundExceptionHandler;
import bitxon.dropwizard.mapper.AccountMapper;
import bitxon.dropwizard.resource.AccountResource;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.SerializationFeature;
import io.dropwizard.client.JerseyClientBuilder;
import io.dropwizard.core.Application;
import io.dropwizard.core.setup.Bootstrap;
Expand Down Expand Up @@ -67,6 +69,10 @@ protected void configure() {
var exchangeClient = new ExchangeClient(client, configuration.getExchangeClientConfig());
environment.jersey().register(exchangeClient);

var objectMapper = environment.getObjectMapper();
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
objectMapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); // not really necessary, but shows how to customize Jackson


environment.jersey().register(AccountResource.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ void getById() {
.get("/accounts/{id}")
.then()
.statusCode(200)
.body("id", is(expectedId));
.body("id", is(expectedId))
.body("dateOfBirth", is("1991-01-21"));
//@formatter:on
}

Expand Down
6 changes: 6 additions & 0 deletions micronaut-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ netty:
allocator:
max-order: 3

jackson:
serialization:
WRITE_DATES_AS_TIMESTAMPS: false
deserialization:
ACCEPT_SINGLE_VALUE_AS_ARRAY: true # not really necessary, but shows how to customize Jackson

datasources:
default:
maximum-pool-size: 40 # default=10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ void getById() {
.get("/accounts/{id}")
.then()
.statusCode(200)
.body("id", is(expectedId));
.body("id", is(expectedId))
.body("dateOfBirth", is("1991-01-21"));
//@formatter:on
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package bitxon.quarkus.customization;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.jackson.ObjectMapperCustomizer;
import jakarta.inject.Singleton;
Expand All @@ -9,6 +9,6 @@
public class RegisterObjectMapperCustomizer implements ObjectMapperCustomizer {

public void customize(ObjectMapper mapper) {
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); // not really necessary, but shows how to customize Jackson
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.is;

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
Expand All @@ -11,13 +12,18 @@ public class GetAccountByIdQuarkusTest extends AbstractQuarkusTest {

@Test
public void getById() {
var expectedId = 1;

//@formatter:off
given()
.pathParam("id", expectedId)
.when()
.get("/accounts/1")
.get("/accounts/{id}")
.then()
.statusCode(200);
//@formatter:off
.statusCode(200)
.body("id", is(expectedId))
.body("dateOfBirth", is("1991-01-21"));
//@formatter:on
}

@Test
Expand Down
1 change: 1 addition & 0 deletions spring-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencyManagement {
dependencies {
implementation project(":common-api")
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-restclient'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
Expand Down
3 changes: 3 additions & 0 deletions spring-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ management:
port: 8081

spring:
jackson:
deserialization:
ACCEPT_SINGLE_VALUE_AS_ARRAY: true # not really necessary, but shows how to customize Jackson
datasource:
hikari:
maximum-pool-size: 40 # default=10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ void getById() {
.get("/accounts/{id}")
.then()
.statusCode(200)
.body("id", is(expectedId));
.body("id", is(expectedId))
.body("dateOfBirth", is("1991-01-21"));
//@formatter:on
}

Expand Down