JAVA-31000 : Upgrade Spring Boot Runtime and Spring Boot Runtime2 to Spring Boot 3. (#16138)

* JAVA-31000 : Upgrade Spring Boot Runtime and Spring Boot Runtime2 to Spring Boot 3

* JAVA-31000 :- Uncomment in Parent module POM.

* Remove unnecessary imports
This commit is contained in:
Amit Pandey 2024-03-17 17:34:56 +05:30 committed by GitHub
parent 90b019d0bf
commit aaeb72e89d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 41 additions and 38 deletions

View File

@ -66,8 +66,8 @@
<module>spring-boot-performance</module>
<module>spring-boot-property-exp</module>
<module>spring-boot-request-params</module>
<!-- <module>spring-boot-runtime</module>--> <!-- failing after upgrading to spring boot 3.2.x -->
<!-- <module>spring-boot-runtime-2</module>--> <!-- failing after upgrading to spring boot 3.2.x -->
<module>spring-boot-runtime</module>
<module>spring-boot-runtime-2</module>
<module>spring-boot-security</module>
<module>spring-boot-security-2</module>
<module>spring-boot-ssl-bundles</module>

View File

@ -75,5 +75,6 @@
<properties>
<springcloud.version>3.1.3</springcloud.version>
<start-class>com.baeldung.heap.HeapSizeDemoApplication</start-class>
</properties>
</project>

View File

@ -69,8 +69,8 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
</dependency>
<dependency>
<groupId>org.subethamail</groupId>
@ -79,14 +79,16 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.3.1</version>
</dependency>
</dependencies>
<properties>
<subethasmtp.version>3.1.7</subethasmtp.version>
<springcloud.version>3.1.3</springcloud.version>
<start-class>com.baeldung.shutdown.Application</start-class>
</properties>
</project>

View File

@ -4,7 +4,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;

View File

@ -1,6 +1,6 @@
package com.baeldung.sampleapp.web.controller.redirect;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;

View File

@ -1,6 +1,6 @@
package com.baeldung.shutdown;
import javax.annotation.PreDestroy;
import jakarta.annotation.PreDestroy;
public class TerminateBean {

View File

@ -9,8 +9,8 @@ import org.springframework.security.web.SecurityFilterChain;
public class SecurityConfig {
@Bean
public SecurityFilterChain securityFilter(HttpSecurity http) throws Exception {
return http.csrf()
.ignoringAntMatchers("/actuator/**").and()
return http
.csrf(csrf -> csrf.ignoringRequestMatchers("/actuator/**") )
.build();
}
}

View File

@ -4,22 +4,23 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import org.springframework.boot.actuate.trace.http.HttpTrace;
import org.springframework.boot.actuate.trace.http.HttpTraceRepository;
import org.apache.hc.client5.http.classic.methods.HttpTrace;
import org.springframework.boot.actuate.web.exchanges.HttpExchange;
import org.springframework.boot.actuate.web.exchanges.HttpExchangeRepository;
import org.springframework.stereotype.Repository;
@Repository
public class CustomTraceRepository implements HttpTraceRepository {
public class CustomTraceRepository implements HttpExchangeRepository {
AtomicReference<HttpTrace> lastTrace = new AtomicReference<>();
AtomicReference<HttpExchange> lastTrace = new AtomicReference<>();
@Override
public List<HttpTrace> findAll() {
public List<HttpExchange> findAll() {
return Collections.singletonList(lastTrace.get());
}
@Override
public void add(HttpTrace trace) {
public void add(HttpExchange trace) {
if ("GET".equals(trace.getRequest()
.getMethod())) {
lastTrace.set(trace);

View File

@ -1,23 +1,22 @@
package com.baeldung.spring.boot.management.trace;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.boot.actuate.trace.http.HttpExchangeTracer;
import org.springframework.boot.actuate.trace.http.HttpTraceRepository;
import org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter;
import org.springframework.boot.actuate.web.exchanges.HttpExchangeRepository;
import org.springframework.boot.actuate.web.exchanges.Include;
import org.springframework.boot.actuate.web.exchanges.servlet.HttpExchangesFilter;
import org.springframework.stereotype.Component;
@Component
public class TraceRequestFilter extends HttpTraceFilter {
public class TraceRequestFilter extends HttpExchangesFilter {
/**
* Create a new {@link HttpTraceFilter} instance.
* Create a new {@link HttpExchangesFilter} instance.
*
* @param repository the trace repository
* @param tracer used to trace exchanges
*/
public TraceRequestFilter(HttpTraceRepository repository, HttpExchangeTracer tracer) {
super(repository, tracer);
public TraceRequestFilter(HttpExchangeRepository repository) {
super(repository, Include.defaultIncludes());
}
@Override

View File

@ -2,9 +2,9 @@ package com.baeldung.web.log.app;
import org.springframework.util.StreamUtils;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import jakarta.servlet.ServletInputStream;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequestWrapper;
import java.io.*;
public class CachedHttpServletRequest extends HttpServletRequestWrapper {

View File

@ -3,8 +3,8 @@ package com.baeldung.web.log.app;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import jakarta.servlet.ReadListener;
import jakarta.servlet.ServletInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

View File

@ -8,11 +8,11 @@ import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebFilter;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

View File

@ -1,6 +1,6 @@
package com.baeldung.web.log.controller;
import javax.validation.Valid;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;