Upgrade samples to Spring Boot 3.0.0-SNAPSHOT #

Closes gh-2074
This commit is contained in:
Eleftheria Stein
2022-04-29 10:25:48 +02:00
parent ea0aef9d97
commit 42580c3a44
10 changed files with 24 additions and 19 deletions

View File

@@ -4,7 +4,7 @@ buildscript {
snapshotBuild = version.endsWith('SNAPSHOT') snapshotBuild = version.endsWith('SNAPSHOT')
milestoneBuild = !(releaseBuild || snapshotBuild) milestoneBuild = !(releaseBuild || snapshotBuild)
springBootVersion = '2.5.5' springBootVersion = '3.0.0-SNAPSHOT'
} }
repositories { repositories {

View File

@@ -19,11 +19,11 @@ package sample.session;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import javax.servlet.FilterChain; import jakarta.servlet.FilterChain;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import jakarta.servlet.http.HttpSession;
import com.maxmind.geoip2.DatabaseReader; import com.maxmind.geoip2.DatabaseReader;
import com.maxmind.geoip2.model.CityResponse; import com.maxmind.geoip2.model.CityResponse;

View File

@@ -21,8 +21,8 @@
<tr th:each="sessionElement : ${sessions}" th:with="details=${sessionElement.getAttribute('SESSION_DETAILS')}"> <tr th:each="sessionElement : ${sessions}" th:with="details=${sessionElement.getAttribute('SESSION_DETAILS')}">
<td th:text="${sessionElement.id.substring(30)}"></td> <td th:text="${sessionElement.id.substring(30)}"></td>
<td th:text="${details?.location}"></td> <td th:text="${details?.location}"></td>
<td th:text="${#temporals.format(sessionElement.creationTime.atZone(T(java.time.ZoneId).systemDefault()),'dd/MMM/yyyy HH:mm:ss')}"></td> <td th:text="${#dates.format(sessionElement.creationTime,'dd/MMM/yyyy HH:mm:ss')}"></td>
<td th:text="${#temporals.format(sessionElement.lastAccessedTime.atZone(T(java.time.ZoneId).systemDefault()),'dd/MMM/yyyy HH:mm:ss')}"></td> <td th:text="${#dates.format(sessionElement.lastAccessedTime,'dd/MMM/yyyy HH:mm:ss')}"></td>
<td th:text="${details?.accessType}"></td> <td th:text="${details?.accessType}"></td>
<td> <td>
<form th:action="@{'/sessions/' + ${sessionElement.id}}" th:method="post"> <form th:action="@{'/sessions/' + ${sessionElement.id}}" th:method="post">

View File

@@ -2,3 +2,7 @@ logging:
level: level:
org.springframework.data.mongodb: DEBUG org.springframework.data.mongodb: DEBUG
org.springframework.session: DEBUG org.springframework.session: DEBUG
spring:
mongodb:
embedded:
version: 3.4.3

View File

@@ -5,7 +5,7 @@ dependencies {
implementation "org.springframework.boot:spring-boot-starter-web" implementation "org.springframework.boot:spring-boot-starter-web"
implementation "org.springframework.boot:spring-boot-starter-thymeleaf" implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
implementation "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect" implementation "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
implementation "org.thymeleaf.extras:thymeleaf-extras-springsecurity5" implementation "org.thymeleaf.extras:thymeleaf-extras-springsecurity6"
implementation "org.springframework.boot:spring-boot-starter-data-mongodb" implementation "org.springframework.boot:spring-boot-starter-data-mongodb"
implementation "org.springframework.boot:spring-boot-starter-security" implementation "org.springframework.boot:spring-boot-starter-security"
implementation "de.flapdoodle.embed:de.flapdoodle.embed.mongo" implementation "de.flapdoodle.embed:de.flapdoodle.embed.mongo"

View File

@@ -1,3 +1,4 @@
spring.thymeleaf.cache=false spring.thymeleaf.cache=false
spring.template.cache=false spring.template.cache=false
spring.data.mongodb.port=0 spring.data.mongodb.port=0
spring.mongodb.embedded.version=3.4.3

View File

@@ -1,4 +1,4 @@
<html xmlns:layout="https://github.com/ultraq/thymeleaf-layout-dialect" layout:decorator="layout"> <html xmlns:layout="https://github.com/ultraq/thymeleaf-layout-dialect" layout:decorate="layout">
<head> <head>
<title>Secured Content</title> <title>Secured Content</title>
</head> </head>

View File

@@ -3,7 +3,7 @@
xmlns:th="https://www.thymeleaf.org" xmlns:th="https://www.thymeleaf.org"
xmlns:layout="https://github.com/ultraq/thymeleaf-layout-dialect"> xmlns:layout="https://github.com/ultraq/thymeleaf-layout-dialect">
<head> <head>
<title layout:title-pattern="$DECORATOR_TITLE - $CONTENT_TITLE">Spring Session Sample</title> <title layout:title-pattern="$LAYOUT_TITLE - $CONTENT_TITLE">Spring Session Sample</title>
<link rel="icon" type="image/x-icon" th:href="@{/resources/img/favicon.ico}" href="../static/img/favicon.ico"/> <link rel="icon" type="image/x-icon" th:href="@{/resources/img/favicon.ico}" href="../static/img/favicon.ico"/>
<link th:href="@{/webjars/bootstrap/css/bootstrap.min.css}" href="/webjars/bootstrap/css/bootstrap.min.css" rel="stylesheet"></link> <link th:href="@{/webjars/bootstrap/css/bootstrap.min.css}" href="/webjars/bootstrap/css/bootstrap.min.css" rel="stylesheet"></link>
<style type="text/css"> <style type="text/css">

View File

@@ -16,7 +16,7 @@
package sample.web; package sample.web;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;

View File

@@ -18,13 +18,13 @@ package sample.data;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Column; import jakarta.persistence.Column;
import javax.persistence.Entity; import jakarta.persistence.Entity;
import javax.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;
import javax.persistence.GenerationType; import jakarta.persistence.GenerationType;
import javax.persistence.Id; import jakarta.persistence.Id;
import javax.validation.constraints.Email; import jakarta.validation.constraints.Email;
import javax.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;