JAVA-32052 Upgrade spring-5-mvc to Spring Boot 3 (#16212)

This commit is contained in:
timis1 2024-03-27 14:54:57 +02:00 committed by GitHub
parent c957410b7e
commit 2a7b672000
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 17 additions and 31 deletions

View File

@ -10,9 +10,9 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId>
<artifactId>parent-boot-3</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-boot-2</relativePath>
<relativePath>../../parent-boot-3</relativePath>
</parent>
<dependencies>
@ -52,19 +52,14 @@
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${jayway-rest-assured.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@ -72,11 +67,6 @@
<artifactId>javafaker</artifactId>
<version>${javafaker.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
</dependencies>
<build>
@ -84,8 +74,6 @@
</build>
<properties>
<jayway-rest-assured.version>2.9.0</jayway-rest-assured.version>
<httpclient.version>4.5.8</httpclient.version>
<start-class>com.baeldung.Spring5Application</start-class>
<javafaker.version>0.18</javafaker.version>
</properties>

View File

@ -6,7 +6,7 @@ import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import org.springframework.stereotype.Component;

View File

@ -1,9 +1,9 @@
package com.baeldung.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class Foo {

View File

@ -2,8 +2,8 @@ package com.baeldung.web;
import java.util.List;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;

View File

@ -13,7 +13,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter
@Controller
public class ResponseBodyEmitterController {
private ExecutorService nonBlockingService = Executors.newCachedThreadPool();
private final ExecutorService nonBlockingService = Executors.newCachedThreadPool();
@GetMapping(Constants.API_RBE)
public ResponseEntity<ResponseBodyEmitter> handleRbe() {
@ -29,7 +29,7 @@ public class ResponseBodyEmitterController {
}
});
return new ResponseEntity(emitter, HttpStatus.OK);
return new ResponseEntity<>(emitter, HttpStatus.OK);
}
}

View File

@ -14,7 +14,7 @@ import com.baeldung.Constants;
@Controller
public class SseEmitterController {
private ExecutorService nonBlockingService = Executors.newCachedThreadPool();
private final ExecutorService nonBlockingService = Executors.newCachedThreadPool();
@GetMapping(Constants.API_SSE)
public SseEmitter handleSse() {

View File

@ -17,7 +17,7 @@ public class StreamingResponseBodyController {
String msg = Constants.API_SRB_MSG + " @ " + new Date();
out.write(msg.getBytes());
};
return new ResponseEntity(stream, HttpStatus.OK);
return new ResponseEntity<>(stream, HttpStatus.OK);
}
}

View File

@ -6,9 +6,9 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.springframework.http.MediaType;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
import com.jayway.restassured.specification.RequestSpecification;
import io.restassured.RestAssured;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
public class LiveTest {
@ -36,8 +36,6 @@ public class LiveTest {
assertEquals(200, response.getStatusCode());
}*/
//
private final String resourceWithNullName() {
return "{\"name\":null}";
}