Skip to content

ACC-2461-update-appserver-to-Spring-boot-4#215

Open
matteo-hlvt wants to merge 19 commits intomainfrom
ACC-2461-update-appserver-to-Spring-boot-4
Open

ACC-2461-update-appserver-to-Spring-boot-4#215
matteo-hlvt wants to merge 19 commits intomainfrom
ACC-2461-update-appserver-to-Spring-boot-4

Conversation

@matteo-hlvt
Copy link

No description provided.

@matteo-hlvt matteo-hlvt requested a review from a team as a code owner January 20, 2026 13:35
Comment on lines +28 to +36
private Optional<ObjectMapper> selectObjectMapperFor(HttpMessageConverters httpMessageConverters, Class<?> type) {
return httpMessageConverters.getConverters().stream()
.filter(AbstractJackson2HttpMessageConverter.class::isInstance)
.map(AbstractJackson2HttpMessageConverter.class::cast)
.filter(converter -> converter.canWrite(type, MediaTypes.HAL_JSON))
.map(converter -> converter.getObjectMappersForType(type).get(MediaTypes.HAL_JSON))
.filter(Objects::nonNull)
.findFirst();
}
Copy link
Contributor

@NielsCW NielsCW Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this code is doing. It is the only usage of HttpMessageConverters which is no longer exposed as bean. @rschev is this a workaround to find the same objectMapper that is used by application/vnd.hal+json serialization? This workaround no longer seems to work with jackson 3, because JsonMapper instances are used instead of objectMapper instances.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fetching the object mapper that creates HAL, so we can use it to generate events with the same format as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an idea how to fix this one: just create a JsonMapper and apply the org.springframework.hateoas.mediatype.hal.Jackson2HalModule.

mapper = halMediaTypeConfiguration.configureObjectMapper(mapper);
addView(mapper, HalFormsView.class);
// @Override
// public ObjectMapper configureObjectMapper(ObjectMapper mapper) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is now called configureJsonMapper (because jackson 3 no longer uses ObjectMapper, but JsonMapper). It seems it is no longer possible to set a default view on JsonMapper or JsonMapper.Builder. We must look into some other way in hiding the _templates field in application/vnd.hal+json responses. (Now we use @JsonView.) Perhaps using a custom mixin class for application/vnd.hal+json and registering this mixin class in the HalMediaTypeConfiguration.

Comment on lines +9 to 13
implementation 'org.springframework.boot:spring-boot-http-converter'
implementation 'org.springframework.boot:spring-boot-flyway'
implementation 'org.springframework.boot:spring-boot-jooq'
implementation 'org.springframework.boot:spring-boot-security'
implementation 'com.contentgrid.thunx:thunx-autoconfigure'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So autoconfigurations are moved to new projects? If it is not for the autoconfigurations, it might be compileOnly.

testImplementation 'com.contentgrid.thunx:thunx-spring-api'
testRuntimeOnly 'org.springframework:spring-webflux'

runtimeOnly 'org.flywaydb:flyway-database-postgresql'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it testRuntimeOnly. Might be even removed if the tests work without.

Copy link
Contributor

@NielsCW NielsCW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it might be easier to update smaller projects to spring-boot 4 first. This project relies on thunx and contentgrid-hateoas, which likely also need to be on spring-boot 4 for this update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants