Commit b20d28e
authored
Upgrade to spring-boot 4 (#922)
* bump spring-boot-starter-parent from 3.5.14 to 4.1.0 (latest)
* Upgrade to Jackson 3 (#934)
* upgrade fairdatateam packages:
- bump spring-security-acl-mongodb version from 6.0.4 to 6.0.5
- bump rdf-resource-resolver version from 0.2.0 to 0.2.2
- bump spring-rdf-migration version from 2.0.0 to 2.0.1
* replace spring.data.mongodb by spring.mongodb in application.yml
see https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Configuration-Changelog
* rename spring-boot-starter-aop to spring-boot-starter-aspectj
see https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#aop-starter-pom
* replace deprecated spring-boot-starter-web by spring-boot-starter-webmvc and replace spring-boot-starter-test by spring-boot-starter-webmvc-test (which brings in spring-boot-starter-test as transitive dependency)
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#deprecated-starters
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#test-code
* remove android-json exclusion from spring-boot-starter-test, as it does not appear to do anything
* replace spring-security-test by spring-boot-starter-security-test, as mentioned in https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#test-code
* remove redundant spring-data-mongodb dependency, because this is already pulled in by spring-boot-starter-data-mongodb (via spring-boot-starter-mongodb)
https://central.sonatype.com/artifact/org.springframework.boot/spring-boot-starter-data-mongodb/4.0.6
https://central.sonatype.com/artifact/org.springframework.boot/spring-boot-data-mongodb/4.0.6
* replace deprecated PersistenceConstructor by PersistenceCreator (cannot find this in spring-data-commons release notes, but see e.g. spring-projects/spring-data-neo4j@1c11be9)
* add spring-boot-starter-restclient and corresponding test starter, 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
* fix imports for AutoConfigureMockMvc and AutoConfigureMockRestServiceServer, because these have been moved from org.springframework.boot.test.autoconfigure.web to two different packages
* add spring-boot-starter-micrometer-metrics dependency and fix corresponding metrics imports (see spring-projects/spring-boot#50788)
* revert spring-boot-starter-micrometer-metrics dependency because spring-boot-starter-actuator already pulls that in (see https://github.com/spring-projects/spring-boot/blob/2edca39504f8e9c2943262d3e60ba34b0e7751ac/starter/spring-boot-starter-actuator/build.gradle#L25)
* remove unused setFromHttpEntity method, because, not only is it unused, but it 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>>"
* fix TestRestTemplate imports (class has been moved to org.springframework.boot.resttestclient package in spring-boot 4)
* replace ClientHttpRequestFactorySettings.Redirects by HttpRedirects because org.springframework.boot.http.client.ClientHttpRequestFactorySettings has been removed, apparently
* fix HttpHeaders assertions because the class no longer extends MultiValueMap
* rearrange httpclient5 dependency (this was listed under 'Test' dependencies, but does not specify the test scope)
* explicit dependency on jakarta.servlet-api
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
* bump springdoc-openapi-starter-webmvc-ui from 2.8.16 to 3.0.3, for compatibility with spring-boot 4 (spring 7)
* add @AutoConfigureTestRestTemplate to WebIntegrationTest because @SpringBootTest no longer provides the TestRestTemplate bean, as mentioned in the migration guide:
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#using-webclient-or-testresttemplate-and-springboottest
* make setup() public in HarvesterServiceTest
* clean up spring-boot-starters, following the spring-boot-starter-classic workflow described in the spring boot 4 migration guide
* explicit jackson dependency: we import directly from the jackson packages in many places, so the dependency should be explicit instead of only transitive
* explicit dependency on spring-boot-data-mongodb
* use jspecify @nullable in AbstractMetadataRepository (this is the only use of @nullable in the fdp)
* handle null in ResourceDefinitionTargetClassesCache 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)"
* fix style for ResourceDefinitionTargetClassesCache
* configure mongodb uuid representation
an 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
* explicit no-args constructor for MetadataSchemaDraftDTO marked as @JsonCreator (fixes the "Cannot map `null` into type `boolean`" error)
also see FasterXML/jackson-databind#5318 and https://github.com/FasterXML/jackson/wiki/Jackson-Release-3.0#jackson-databind
* 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
* switch WebMvcConfig to constructor autowiring, while we're at it
* update configureMessageConverters to use ServerBuilder because the original method is deprecated for removal
* annotate ContentNegotiationConfigurer NonNull to match parent signature
* explicit dependency on slf4j, because it is used explicitly throughout the code, but was only included transitively (implicitly)1 parent 888b539 commit b20d28e
29 files changed
Lines changed: 172 additions & 135 deletions
File tree
- src
- main
- java/org/fairdatateam/fairdatapoint
- api
- dto/schema
- filter
- config
- database/rdf/repository
- entity
- index/http
- schema
- service
- index
- event
- webhook
- resource
- schema
- resources
- test
- java/org/fairdatateam/fairdatapoint
- acceptance
- actuator
- common
- general
- metadata
- openapi
- schema
- search/sparql
- service/index/harvester
- resources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | | - | |
| 134 | + | |
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| |||
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
143 | | - | |
| 145 | + | |
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
147 | | - | |
| 149 | + | |
148 | 150 | | |
149 | 151 | | |
150 | 152 | | |
151 | | - | |
| 153 | + | |
152 | 154 | | |
153 | 155 | | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
157 | 159 | | |
158 | | - | |
159 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
160 | 163 | | |
161 | 164 | | |
162 | 165 | | |
163 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
164 | 172 | | |
165 | 173 | | |
| 174 | + | |
| 175 | + | |
166 | 176 | | |
167 | | - | |
| 177 | + | |
| 178 | + | |
168 | 179 | | |
169 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
170 | 191 | | |
171 | 192 | | |
172 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
173 | 208 | | |
174 | 209 | | |
175 | 210 | | |
176 | 211 | | |
| 212 | + | |
| 213 | + | |
177 | 214 | | |
178 | 215 | | |
179 | 216 | | |
| |||
182 | 219 | | |
183 | 220 | | |
184 | 221 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | 222 | | |
190 | 223 | | |
191 | 224 | | |
| |||
238 | 271 | | |
239 | 272 | | |
240 | 273 | | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | 274 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 275 | + | |
| 276 | + | |
255 | 277 | | |
256 | 278 | | |
257 | | - | |
258 | | - | |
259 | | - | |
| 279 | + | |
| 280 | + | |
260 | 281 | | |
261 | 282 | | |
262 | | - | |
263 | | - | |
| 283 | + | |
| 284 | + | |
264 | 285 | | |
| 286 | + | |
265 | 287 | | |
266 | 288 | | |
267 | 289 | | |
| |||
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
66 | 75 | | |
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 48 | + | |
| 49 | + | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
Lines changed: 37 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
27 | 26 | | |
28 | 27 | | |
29 | | - | |
| 28 | + | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | | - | |
| 34 | + | |
36 | 35 | | |
37 | | - | |
| 36 | + | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| 41 | + | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
46 | | - | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
50 | | - | |
51 | | - | |
| 49 | + | |
52 | 50 | | |
53 | | - | |
54 | | - | |
| 51 | + | |
55 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
56 | 66 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
63 | 73 | | |
64 | 74 | | |
65 | 75 | | |
66 | | - | |
| 76 | + | |
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
| |||
75 | 85 | | |
76 | 86 | | |
77 | 87 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
84 | 97 | | |
85 | 98 | | |
86 | 99 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
0 commit comments