ACC-2461-update-appserver-to-Spring-boot-4#215
Conversation
…approach" This reverts commit a0b695f.
| 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(); | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
This is fetching the object mapper that creates HAL, so we can use it to generate events with the same format as well
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
| 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' |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
Make it testRuntimeOnly. Might be even removed if the tests work without.
NielsCW
left a comment
There was a problem hiding this comment.
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.
No description provided.