Skip to content

Upgrade to spring-boot 4#922

Merged
dennisvang merged 44 commits into
masterfrom
maintenance/920-upgrade-to-spring-boot-4
Jun 26, 2026
Merged

Upgrade to spring-boot 4#922
dennisvang merged 44 commits into
masterfrom
maintenance/920-upgrade-to-spring-boot-4

Conversation

@dennisvang

@dennisvang dennisvang commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

fixes #920 (see issue for detailed notes)

fixes #933 (via #934)

Note

If you're seeing mongodb connection issues, make sure your run configuration is updated to use spring.mongodb.uri instead of the old spring.data.mongodb.uri.

@dennisvang dennisvang added chore Maintenance dependencies Related to dependencies labels Jun 10, 2026
@dennisvang dennisvang force-pushed the maintenance/920-upgrade-to-spring-boot-4 branch from b5d290c to fdf8340 Compare June 10, 2026 20:34
cannot find this in spring-data-commons release notes, but see e.g. spring-projects/spring-data-neo4j@1c11be9
and fix corresponding RestTemplateBuilder import
and replace deprecated setConnectionTimeout and setReadTimeout calls

https://docs.spring.io/spring-boot/3.4/api/java/org/springframework/boot/web/client/RestTemplateBuilder.html
pulling in fixes to metrics config and default profile
pulling in the updated cors config and the fix for removed .apply() method in SecurityConfig
…Server

these have been moved from org.springframework.boot.test.autoconfigure.web to two different packages
it is not used, and also gives rise to the following error in spring-boot 4:
incompatible types: org.springframework.http.HttpHeaders cannot be converted to java.util.Map<java.lang.String,java.util.List<java.lang.String>>
class has been moved to org.springframework.boot.resttestclient package in spring-boot 4
because org.springframework.boot.http.client.ClientHttpRequestFactorySettings has been removed, apparently
pulling in the checkstyle rule to allow long URls in inline comments
was listed under 'Test' dependencies, but does not specify the test scope
This is available via spring-boot starters (jetty?), but we depend heavily on this package and import explicitly from it, so better make the dependency explicit.
The package version is managed by spring boot.
https://docs.spring.io/spring-boot/appendix/dependency-versions/coordinates.html
for compatibility with spring-boot 4 (spring 7)
this was done following the spring-boot-starter-classic workflow described in the spring boot 4 migration guide
we import directly from the jackson packages in many places, so the dependency should be explicit instead of only transitive
to get rid of the nullpointerexceptions in tests, like:

Cannot invoke "org.fairdatateam.fairdatapoint.entity.schema.MetadataSchema.getTargetClasses()"
    because the return value of "java.util.Map.get(Object)" is null at
    org.fairdatateam.fairdatapoint.service.resource.ResourceDefinitionTargetClassesCache.lambda$computeCache$2(ResourceDefinitionTargetClassesCache.java:84)
pulling in DRY project versioning and some dependency updates
alternative would be something like:

```java
@configuration
public class MongoClientConfig extends AbstractMongoClientConfiguration {

    @value("${spring.mongodb.database}")
    private String databaseName;

    @OverRide
    protected void configureClientSettings(MongoClientSettings.Builder builder) {
        builder.uuidRepresentation(UuidRepresentation.STANDARD);
    }

    @OverRide
    protected @nonnull String getDatabaseName() {
        return databaseName;
    }
}
```

https://docs.spring.io/spring-data/mongodb/reference/migration-guide/migration-guide-4.x-to-5.x.html
* change MetadataSchemaDraftDTO.abstractSchema boolean to Boolean

  this fixes the following error: "Cannot map null into type boolean (set DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES to 'false' to allow)"

* replace ObjectMapper by JsonMapper with new builder api

  - fix corresponding imports: com.fasterxml.jackson moved to tools.jackson except for com.fasterxml.jackson.annotation
  - replace JsonProcessingException by JacksonException
  - replace MappingJackson2HttpMessageConverter by JacksonJsonHttpMessageConverter
because the original method is deprecated for removal
@dennisvang

Copy link
Copy Markdown
Contributor Author

All tests are passing and application starts without errors or warnings. First quick manual interactions via client are looking good.

@dennisvang dennisvang marked this pull request as ready for review June 22, 2026 19:13
@dennisvang

Copy link
Copy Markdown
Contributor Author

End-to-end tests from the E2E repo also pass (running locally).

@dennisvang dennisvang merged commit b20d28e into master Jun 26, 2026
13 checks passed
@dennisvang dennisvang deleted the maintenance/920-upgrade-to-spring-boot-4 branch June 26, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance dependencies Related to dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to Jackson 3 Upgrade to spring-boot 4

1 participant