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