From 9e64f48603013c05d42651e8159b2da066929ded Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 30 Apr 2026 10:01:10 +0000 Subject: [PATCH] feat: migrate to Java 25 and Spring Boot 4.0.6 - Upgrade Java from 17 to 25 (latest LTS) - Upgrade Spring Boot from 3.3.3 to 4.0.6 - Update maven-compiler-plugin from 3.8.0 to 3.14.0, use release instead of source/target - Replace deprecated mysql:mysql-connector-java with com.mysql:mysql-connector-j - Remove unused thymeleaf-extras-springsecurity6 dependency - Update Dockerfile to use Eclipse Temurin images (maven:3.9-eclipse-temurin-25, eclipse-temurin:25-jre-alpine) - Remove deprecated openjdk Docker images - Remove explicit MySQL8Dialect (auto-detected by Hibernate) - Replace removed AntPathRequestMatcher with logoutUrl() for Spring Security 7 compatibility Co-Authored-By: Joao Esteves --- Dockerfile | 20 ++++--------------- pom.xml | 19 ++++++------------ .../bankapp/config/SecurityConfig.java | 3 +-- src/main/resources/application.properties | 1 - 4 files changed, 11 insertions(+), 32 deletions(-) diff --git a/Dockerfile b/Dockerfile index 079acabe..d47e9672 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,25 @@ #---------------------------------- -# Stage 1 +# Stage 1: Build #---------------------------------- -# Import docker image with maven installed -FROM maven:3.8.3-openjdk-17 as builder +FROM maven:3.9-eclipse-temurin-25 AS builder -# Add maintainer, so that new user will understand who had written this Dockerfile -MAINTAINER Madhup Pandey - -# Add labels to the image to filter out if we have multiple application running LABEL app=bankapp -# Set working directory WORKDIR /src -# Copy source code from local to container COPY . /src -# Build application and skip test cases RUN mvn clean install -DskipTests=true #-------------------------------------- -# Stage 2 +# Stage 2: Runtime #-------------------------------------- -# Import small size java image -FROM openjdk:17-alpine as deployer +FROM eclipse-temurin:25-jre-alpine AS deployer -# Copy build from stage 1 (builder) COPY --from=builder /src/target/*.jar /src/target/bankapp.jar -# Expose application port EXPOSE 8080 -# Start the application ENTRYPOINT ["java", "-jar", "/src/target/bankapp.jar"] diff --git a/pom.xml b/pom.xml index fc5bfeac..68fac1a5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.3 + 4.0.6 com.example @@ -27,7 +27,7 @@ - 17 + 25 @@ -47,14 +47,8 @@ spring-boot-starter-web - org.thymeleaf.extras - thymeleaf-extras-springsecurity6 - - - - mysql - mysql-connector-java - 8.0.33 + com.mysql + mysql-connector-j runtime @@ -78,10 +72,9 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.14.0 - 1.8 - 1.8 + ${java.version} diff --git a/src/main/java/com/example/bankapp/config/SecurityConfig.java b/src/main/java/com/example/bankapp/config/SecurityConfig.java index 4dbd1572..d86fcb92 100644 --- a/src/main/java/com/example/bankapp/config/SecurityConfig.java +++ b/src/main/java/com/example/bankapp/config/SecurityConfig.java @@ -10,7 +10,6 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.SecurityFilterChain; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; @Configuration @EnableWebSecurity @@ -41,7 +40,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti .logout(logout -> logout .invalidateHttpSession(true) .clearAuthentication(true) - .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) + .logoutUrl("/logout") .logoutSuccessUrl("/login?logout") .permitAll() ) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 08663a63..8a4ff811 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -7,5 +7,4 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # JPA & Hibernate configuration spring.jpa.hibernate.ddl-auto=update -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect spring.jpa.show-sql=true