Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Spring Boot to 2.7 #3291

Open
wants to merge 3 commits into
base: dev-2023-2-1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.13</version>
<version>2.7.16</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -106,6 +106,13 @@
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-mongodb</artifactId>
<exclusions>
<!-- exclude outdated mongodb driver -->
<exclusion>
<artifactId>mongo-java-driver</artifactId>
<groupId>org.mongodb</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- override jaxb dependencies version of oauth2 -->
<dependency>
Expand Down Expand Up @@ -141,6 +148,13 @@
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>4.9.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo.spring27x</artifactId>
<version>4.9.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -181,7 +195,7 @@
<dependency>
<groupId>org.javers</groupId>
<artifactId>javers-spring-boot-starter-mongo</artifactId>
<version>6.5.3</version>
<version>6.14.0</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
Expand Down Expand Up @@ -298,7 +312,7 @@
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.5.13</version>
<version>2.6.8</version>
</dependency>
<dependency>
<groupId>org.zalando</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.dzhw.fdz.metadatamanagement.filemanagement.rest;

import java.io.IOException;
import java.net.URLDecoder;
import java.util.concurrent.TimeUnit;

import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -39,7 +40,7 @@ public class FileResource {
public ResponseEntity<?> downloadFile(HttpServletRequest request) throws IOException {
String completePath =
(String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
String fileName = completePath.replaceFirst("/public/files", "");
String fileName = URLDecoder.decode(completePath.replaceFirst("/public/files", ""), "UTF-8");
// find file in grid fs / mongo db
GridFsResource gridFsFile = this.fileService.findFile(fileName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public ResponseEntity<String> search(@RequestBody(required = false) String body,
(String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
String queryString = request.getQueryString();
String path = completePath.replaceFirst("/api/search", "");
String url = connectionUrl + path;
String url = URLDecoder.decode(connectionUrl + path, "UTF-8");
if (!StringUtils.isEmpty(queryString)) {
url = url + "?" + URLDecoder.decode(queryString, "UTF-8");
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# ===================================================================

spring:
main.allow-circular-references: true
data:
rest:
base-path: /api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -124,7 +125,8 @@ public void createShadowCopyWithSameReleaseVersion() throws Exception {
dataAcquisitionProject.getRelease(), "1.0.0");

List<GridFSFile> files = new ArrayList<>();
gridFsOperations.find(new Query()).forEach(files::add);
gridFsOperations.find(new Query())
.forEach((Consumer<? super GridFSFile>) (GridFSFile f) -> files.add(f));

assertThat(files.size(), equalTo(2));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -124,7 +125,8 @@ public void createShadowCopyWithSameReleaseVersion() throws Exception {
dataAcquisitionProject.getRelease(), "1.0.0");

List<GridFSFile> files = new ArrayList<>();
gridFsOperations.find(new Query()).forEach(files::add);
gridFsOperations.find(new Query())
.forEach((Consumer<? super GridFSFile>) (GridFSFile f) -> files.add(f));

assertThat(files.size(), equalTo(2));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -125,7 +126,8 @@ public void createShadowCopyWithSameReleaseVersion() throws Exception {
dataAcquisitionProject.getRelease(), "1.0.0");

List<GridFSFile> files = new ArrayList<>();
gridFsOperations.find(new Query()).forEach(files::add);
gridFsOperations.find(new Query())
.forEach((Consumer<? super GridFSFile>) (GridFSFile f) -> files.add(f));

assertThat(files.size(), equalTo(2));

Expand Down
5 changes: 5 additions & 0 deletions src/test/resources/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
# JHipster specific properties
# ===================================================================

# properties specific to spring boot upgrade from 2.5 to 2.7
spring.main.allow-circular-references: true
spring.mongodb.embedded.version: 4.2.13
de.flapdoodle.mongodb.embedded.version: 4.2.13

spring:
data:
rest:
Expand Down