[#2845] Bump Spring boot to 4.x (#2941)

Notes:
1. (!) Eclipselink shall be migrated to 5.0 (in 4.0.8 there are incompatible classes, e.g EJBQueryImpl doesn't implement some newer methods). In the moment is with beta (5.0.0-B12) - JUST for testing!
2. (!) Ethlo plugin doesn't work with Eclipselink 5.0, it builds with Eclipselink 4.0.8 (could be a problem)
3. Dependencies - new starters, test starters changes, some dependencies refactoring
4. Auto-configs split - package changes, some properties classes changes
5. Spring nullable org.springframework.lang.Nullable/NonNull are depecated and replaced with jspcify -> org.jspecify.annotations.Nullable/NonNull (NullMarked)
6. Lombok config - adding lombok.addNullAnnotations=jspecify - to do not mess annotations
7. Distributed lock table changes - SP_LOCK table db migration
8. Spring Retry replaced with Spring Core Retry - does repace retry in hawkbit
9. Specifications -> added Update/Delete(/Predicate) Specifications and JpaSpecificationExecutor changed
10. HawkbitBaseRepositoryFactoryBean modified to register properly
11. Jackson - 2 -> 3, package migrations, finals are not deserialized by default(enable finals deserialization, consider make non-final), too ‘smart’ tries to set complex objects instead of using non args constructor (-> @JsonIgnore), some other default configs made

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2026-04-14 11:31:41 +03:00
committed by GitHub
parent 23cd368e00
commit 1be473b22c
172 changed files with 1254 additions and 1045 deletions

View File

@@ -33,7 +33,6 @@ import java.util.Random;
import jakarta.validation.constraints.NotEmpty;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionFactory;
import org.eclipse.hawkbit.artifact.ArtifactStorage;
@@ -195,7 +194,7 @@ public abstract class AbstractIntegrationTest {
public static void afterClass() {
if (new File(ARTIFACT_DIRECTORY).exists()) {
try {
FileUtils.deleteDirectory(new File(ARTIFACT_DIRECTORY));
delete(new File(ARTIFACT_DIRECTORY));
} catch (final IOException | IllegalArgumentException e) {
log.warn("Cannot delete file-directory", e);
}
@@ -236,7 +235,7 @@ public abstract class AbstractIntegrationTest {
public void cleanUp() {
if (new File(ARTIFACT_DIRECTORY).exists()) {
try {
FileUtils.cleanDirectory(new File(ARTIFACT_DIRECTORY));
delete(new File(ARTIFACT_DIRECTORY));
} catch (final IOException | IllegalArgumentException e) {
log.warn("Cannot cleanup file-directory", e);
}
@@ -489,6 +488,22 @@ public abstract class AbstractIntegrationTest {
}
}
protected List<? extends Target> findByUpdateStatus(final TargetUpdateStatus status, final Pageable pageable) {
return targetManagement.findAll(pageable).stream().filter(target -> status.equals(target.getUpdateStatus())).toList();
}
protected TargetType findTargetTypeByName(@NotEmpty String name) {
return targetTypeManagement.findByRsql("name==" + name, UNPAGED).stream().findAny()
.orElseThrow(() -> new EntityNotFoundException(TargetType.class, name));
}
@SafeVarargs
protected static <T> Collection<T> concat(final Collection<T>... targets) {
final List<T> result = new ArrayList<>();
List.of(targets).forEach(result::addAll);
return result;
}
@SuppressWarnings("java:S4042")
private static File createTempDir() {
try {
@@ -514,19 +529,19 @@ public abstract class AbstractIntegrationTest {
}
}
protected List<? extends Target> findByUpdateStatus(final TargetUpdateStatus status, final Pageable pageable) {
return targetManagement.findAll(pageable).stream().filter(target -> status.equals(target.getUpdateStatus())).toList();
}
private static void delete(final File file) throws IOException {
if (file.exists()) {
if (file.isDirectory()) {
// delete children
final File[] children = file.listFiles();
if (children != null) {
for (final File child : children) {
delete(child);
}
}
}
protected TargetType findTargetTypeByName(@NotEmpty String name) {
return targetTypeManagement.findByRsql("name==" + name, UNPAGED).stream().findAny()
.orElseThrow(() -> new EntityNotFoundException(TargetType.class, name));
}
@SafeVarargs
protected static <T> Collection<T> concat(final Collection<T>... targets) {
final List<T> result = new ArrayList<>();
List.of(targets).forEach(result::addAll);
return result;
Files.delete(file.toPath());
}
}
}

View File

@@ -27,7 +27,6 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.IntStream;
import org.apache.commons.io.IOUtils;
import org.eclipse.hawkbit.context.AccessContext;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.Constants;
@@ -481,7 +480,7 @@ public class TestdataFactory {
* @return {@link Artifact} entity.
*/
public Artifact createArtifact(final String artifactData, final Long moduleId, final String filename) {
final InputStream stubInputStream = IOUtils.toInputStream(artifactData, StandardCharsets.UTF_8);
final InputStream stubInputStream = new ByteArrayInputStream(artifactData.getBytes(StandardCharsets.UTF_8));
return artifactManagement.create(new ArtifactUpload(stubInputStream, null, artifactData.length(), null, moduleId, filename, false));
}