Compare commits
116 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec6fd8a902 | ||
|
|
0320e60cf0 | ||
|
|
90d0c1d778 | ||
|
|
058ae80419 | ||
|
|
89fb210f18 | ||
|
|
d48aa09b9c | ||
|
|
02a6dbc08a | ||
|
|
e4a023fa64 | ||
|
|
e8837c83e9 | ||
|
|
b4b9ea8112 | ||
|
|
c571f7479c | ||
|
|
63d7580a69 | ||
|
|
c466aa5dd3 | ||
|
|
acb59258c3 | ||
|
|
e5022757a9 | ||
|
|
ddad8010eb | ||
|
|
fc3e2e1c64 | ||
|
|
eb169f8186 | ||
|
|
5fd7c9ddcf | ||
|
|
8898ceb4a7 | ||
|
|
c4e9a93d02 | ||
|
|
d8ab39eba7 | ||
|
|
6a5f101656 | ||
|
|
88d34035a6 | ||
|
|
81ef425b1b | ||
|
|
280f311677 | ||
|
|
fab1f7b38e | ||
|
|
0dfc97289f | ||
|
|
7c927c7f38 | ||
|
|
cbd1c66c13 | ||
|
|
9f7a969a6e | ||
|
|
5f2523e211 | ||
|
|
26986a6b7d | ||
|
|
58813e9d5a | ||
|
|
c66ee750f9 | ||
|
|
9062db3f55 | ||
|
|
4bf15cda3b | ||
|
|
7f8c0387a7 | ||
|
|
3bc15c4259 | ||
|
|
c9add24c77 | ||
|
|
aaed973d27 | ||
|
|
55c4fcfd3f | ||
|
|
2a5d6b4d2e | ||
|
|
42aa10bfe8 | ||
|
|
2ce570cbdc | ||
|
|
221b48094a | ||
|
|
d43b48bbb0 | ||
|
|
840907993b | ||
|
|
e1dea5e0a8 | ||
|
|
4db41c1caf | ||
|
|
23a32acd56 | ||
|
|
dc8cca5351 | ||
|
|
2369b2cfb3 | ||
|
|
e6ce56ec8b | ||
|
|
36939c1b02 | ||
|
|
0a84f9d544 | ||
|
|
f4840e98a2 | ||
|
|
8c99c9f904 | ||
|
|
f70f1f20f9 | ||
|
|
ac1a77e5fe | ||
|
|
214a556dd4 | ||
|
|
cace484fbe | ||
|
|
a5ec1ccf1f | ||
|
|
7fc0ae47d5 | ||
|
|
ce2e644e04 | ||
|
|
24c198fe98 | ||
|
|
8800fb9816 | ||
|
|
b8e94948ae | ||
|
|
8d2276341f | ||
|
|
2c1b79375d | ||
|
|
63f1c7bf6f | ||
|
|
e8e4ee2850 | ||
|
|
9a643c8866 | ||
|
|
282f774e07 | ||
|
|
fba9313c6b | ||
|
|
e6ec5765b8 | ||
|
|
c2288615bf | ||
|
|
ad52fc0297 | ||
|
|
2516a495af | ||
|
|
9be7ac7fa6 | ||
|
|
c335a49924 | ||
|
|
092e6c6607 | ||
|
|
0924c9558a | ||
|
|
0484781541 | ||
|
|
3995f8bf65 | ||
|
|
ad16f17398 | ||
|
|
11aa50e83c | ||
|
|
ab5c727846 | ||
|
|
a0246a61b6 | ||
|
|
8f20fa328a | ||
|
|
44ff959c59 | ||
|
|
ad67a3775b | ||
|
|
75c60b27bd | ||
|
|
12ce8de84e | ||
|
|
81bd6bd261 | ||
|
|
2e8c4292fd | ||
|
|
315b9c9929 | ||
|
|
a70abd90bd | ||
|
|
f13df5aa2f | ||
|
|
6fd68e093f | ||
|
|
653d820290 | ||
|
|
950ac50234 | ||
|
|
bda72c074f | ||
|
|
fb1362aa2c | ||
|
|
d5dac6629d | ||
|
|
04b4b9ba17 | ||
|
|
97308bdbf4 | ||
|
|
4ba62c71dd | ||
|
|
265099c586 | ||
|
|
2f4a0110ab | ||
|
|
7a1cb66dae | ||
|
|
9bad2afa14 | ||
|
|
dba22292a3 | ||
|
|
c79173879f | ||
|
|
2c065c0241 | ||
|
|
a08c721118 |
1
.github/workflows/antora-generate.yml
vendored
1
.github/workflows/antora-generate.yml
vendored
@@ -1,6 +1,7 @@
|
||||
name: Generate Antora Files and Request Build
|
||||
|
||||
on:
|
||||
workflow_dispatch: # Manual trigger
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'gh-pages'
|
||||
|
||||
@@ -2,8 +2,6 @@ name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '0 10 * * *' # Once per day at 10am UTC
|
||||
workflow_dispatch: # Manual trigger
|
||||
|
||||
6
.sdkmanrc
Normal file
6
.sdkmanrc
Normal file
@@ -0,0 +1,6 @@
|
||||
# Use sdkman to run "sdk env" to initialize with correct JDK version
|
||||
# Enable auto-env through the sdkman_auto_env config
|
||||
# See https://sdkman.io/usage#config
|
||||
# A summary is to add the following to ~/.sdkman/etc/config
|
||||
# sdkman_auto_env=true
|
||||
java=8.0.332-zulu
|
||||
@@ -25,6 +25,13 @@ If you are reporting a bug, please help to speed up problem diagnosis by providi
|
||||
information as possible. Ideally, that would include a small sample project that
|
||||
reproduces the problem.
|
||||
|
||||
== Create your branch from the oldest maintenance branch
|
||||
|
||||
Create your topic branch to be submitted as a pull request from the oldest impacted and supported maintenance branch.
|
||||
You can find the supported versions by looking at the https://github.com/spring-projects/spring-session/milestones[milestones page].
|
||||
Switch to a branch named `<major>.<minor>.x` from the smallest milestone in the format of `<major>.<minor>.<patch>(-<prerelease>)`.
|
||||
The spring team will ensure the code gets merged forward into additional branches.
|
||||
|
||||
|
||||
== Sign the Contributor License Agreement
|
||||
If you have not previously done so, please fill out and
|
||||
|
||||
@@ -25,7 +25,7 @@ Additional Spring Session modules can be found in the https://github.com/spring-
|
||||
|
||||
== Getting Started
|
||||
|
||||
We recommend you visit the https://docs.spring.io/spring-session/docs/current/reference/html5/#samples[Spring Session Reference] and look through the "Samples and Guides" section to see which one best suits your needs.
|
||||
We recommend you visit the https://docs.spring.io/spring-session/reference/index.html[Spring Session Reference] and look through the "Samples and Guides" section to see which one best suits your needs.
|
||||
|
||||
== Samples
|
||||
|
||||
|
||||
110
RELEASE.adoc
Normal file
110
RELEASE.adoc
Normal file
@@ -0,0 +1,110 @@
|
||||
== 1. Update Dependencies
|
||||
|
||||
Dependencies are declared in `gradle/dependency-management.gradle`.
|
||||
Update Spring Framework, Spring Security and Spring Data at a minimum.
|
||||
|
||||
Run all the checks:
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
$ ./gradlew check
|
||||
----
|
||||
|
||||
Create separate issues for each dependency update, aside from test dependencies which can be combined into a single commit.
|
||||
|
||||
== 2. Check All Issues are Closed
|
||||
|
||||
You can manually check at https://github.com/spring-projects/spring-session/milestones
|
||||
|
||||
== 3. Update Release Version
|
||||
|
||||
Update the version number in `gradle.properties` for the release, for example `2.7.0-M1`, `2.7.0-RC1`, `2.7.3`
|
||||
|
||||
== 4. Update Antora Version
|
||||
|
||||
You will need to update the antora.yml version.
|
||||
|
||||
For milestone / release candidate releases you should follow this format:
|
||||
----
|
||||
version: '2.7.0-RC1'
|
||||
prerelease: 'true'
|
||||
display_version: '2.7.0-RC1'
|
||||
----
|
||||
|
||||
== 5. Build Locally
|
||||
|
||||
Run the build using
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
$ ./gradlew check
|
||||
----
|
||||
|
||||
== 6. Push the Release Commit
|
||||
|
||||
Push the commit and GitHub actions will build and deploy the artifacts.
|
||||
Wait for the artifact to appear in https://repo1.maven.org/maven2/org/springframework/session/spring-session-core/
|
||||
|
||||
== 7. Tag the release
|
||||
|
||||
Tag the release and then push the tag
|
||||
|
||||
....
|
||||
git tag 2.7.0-RC1
|
||||
git push origin 2.7.0-RC1
|
||||
....
|
||||
|
||||
== 8. Update to Next Development Version
|
||||
|
||||
Update `gradle.properties` version to next `+SNAPSHOT+` version, update antora.yml and then push
|
||||
|
||||
== 9. Update version on project pages
|
||||
|
||||
Update the versions on https://spring.io/projects for Spring Session Core, Spring Session Data Redis, Spring Session JDBC, Spring Session Hazelcast, and Spring Session MongoDB.
|
||||
|
||||
== 10. Update Release Notes on GitHub
|
||||
|
||||
Download
|
||||
https://github.com/spring-io/github-changelog-generator/releases/latest[the
|
||||
GitHub release notes generator]
|
||||
|
||||
* Generate the release notes
|
||||
|
||||
....
|
||||
java -jar github-changelog-generator.jar \
|
||||
--changelog.repository=spring-projects/spring-session \
|
||||
$MILESTONE release-notes
|
||||
....
|
||||
|
||||
Note 1: `+$MILESTONE+` is something like `+2.7.1+` or `+2.7.0-M1+`. +
|
||||
Note 2: This will create a file on your filesystem
|
||||
called `+release-notes+`.
|
||||
|
||||
* Copy the release notes to your clipboard (your mileage may vary with
|
||||
the following command)
|
||||
|
||||
....
|
||||
cat release-notes | xclip -selection clipboard
|
||||
....
|
||||
|
||||
* Create the
|
||||
https://github.com/spring-projects/spring-session/releases[release on
|
||||
GitHub], associate it with the tag, and paste the generated notes.
|
||||
|
||||
== 11. Close / Create Milestone
|
||||
|
||||
* In
|
||||
https://github.com/spring-projects/spring-session/milestones[GitHub
|
||||
Milestones], create a new milestone for the next release version.
|
||||
* Move any open issues from the existing milestone you just released to
|
||||
the new milestone.
|
||||
* Close the milestone for the release.
|
||||
|
||||
Note: Spring Session typically releases only one milestone (M1) and one release candidate (RC1).
|
||||
|
||||
== 12. Announce the release
|
||||
|
||||
* Announce via Slack on https://pivotal.slack.com/messages/spring-session[#spring-session], and tag any downstream Spring Session projects (e.g Spring Session for Apache Geode).
|
||||
|
||||
Note: Do not post on #spring-release or create a blog post. Those steps happen after the Spring Session BOM is released.
|
||||
|
||||
@@ -4,7 +4,7 @@ buildscript {
|
||||
snapshotBuild = version.endsWith('SNAPSHOT')
|
||||
milestoneBuild = !(releaseBuild || snapshotBuild)
|
||||
|
||||
springBootVersion = '2.5.6'
|
||||
springBootVersion = '2.7.8'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -66,7 +66,7 @@ dependencies {
|
||||
implementation 'io.spring.nohttp:nohttp-gradle:0.0.9'
|
||||
implementation 'net.sourceforge.htmlunit:htmlunit:2.55.0'
|
||||
implementation 'org.hidetake:gradle-ssh-plugin:2.10.1'
|
||||
implementation 'org.jfrog.buildinfo:build-info-extractor-gradle:4.24.20'
|
||||
implementation 'org.jfrog.buildinfo:build-info-extractor-gradle:4.29.0'
|
||||
implementation 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1'
|
||||
|
||||
testImplementation platform('org.junit:junit-bom:5.8.1')
|
||||
|
||||
@@ -18,6 +18,7 @@ package io.spring.gradle.convention
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
|
||||
|
||||
class ArtifactoryPlugin implements Plugin<Project> {
|
||||
|
||||
@@ -37,8 +38,14 @@ class ArtifactoryPlugin implements Plugin<Project> {
|
||||
password = artifactoryPassword
|
||||
}
|
||||
}
|
||||
defaults {
|
||||
publications('mavenJava')
|
||||
}
|
||||
}
|
||||
project.plugins.withType(MavenPublishPlugin) {
|
||||
project.artifactory {
|
||||
publish {
|
||||
defaults {
|
||||
publications('mavenJava')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class RootProjectPlugin implements Plugin<Project> {
|
||||
pluginManager.apply(SchemaPlugin)
|
||||
pluginManager.apply(NoHttpPlugin)
|
||||
pluginManager.apply(SpringNexusPublishPlugin)
|
||||
pluginManager.apply(ArtifactoryPlugin)
|
||||
pluginManager.apply("org.sonarqube")
|
||||
|
||||
project.repositories.mavenCentral()
|
||||
|
||||
@@ -9,7 +9,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
optional 'javax.servlet:javax.servlet-api:3.1.0'
|
||||
optional 'jakarta.servlet:jakarta.servlet-api:4.0.4'
|
||||
testImplementation platform('org.junit:junit-bom:5.8.1')
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-engine'
|
||||
|
||||
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
provided 'javax.servlet:javax.servlet-api'
|
||||
provided 'jakarta.servlet:jakarta.servlet-api:4.0.4'
|
||||
testImplementation 'commons-io:commons-io:2.11.0'
|
||||
testImplementation 'org.assertj:assertj-core:3.21.0'
|
||||
testImplementation platform('org.junit:junit-bom:5.8.1')
|
||||
|
||||
135
git/hooks/forward-merge
Executable file
135
git/hooks/forward-merge
Executable file
@@ -0,0 +1,135 @@
|
||||
#!/usr/bin/ruby
|
||||
require 'json'
|
||||
require 'net/http'
|
||||
require 'yaml'
|
||||
require 'logger'
|
||||
|
||||
$log = Logger.new(STDOUT)
|
||||
$log.level = Logger::WARN
|
||||
|
||||
class ForwardMerge
|
||||
attr_reader :issue, :milestone, :message, :line
|
||||
def initialize(issue, milestone, message, line)
|
||||
@issue = issue
|
||||
@milestone = milestone
|
||||
@message = message
|
||||
@line = line
|
||||
end
|
||||
end
|
||||
|
||||
def find_forward_merges(message_file)
|
||||
$log.debug "Searching for forward merge"
|
||||
rev=`git rev-parse -q --verify MERGE_HEAD`.strip
|
||||
$log.debug "Found #{rev} from git rev-parse"
|
||||
return nil unless rev
|
||||
message = File.read(message_file)
|
||||
forward_merges = []
|
||||
message.each_line do |line|
|
||||
$log.debug "Checking #{line} for message"
|
||||
match = /^(?:Fixes|Closes) gh-(\d+) in (\d\.\d\.[\dx](?:[\.\-](?:M|RC)\d)?)$/.match(line)
|
||||
if match then
|
||||
issue = match[1]
|
||||
milestone = match[2]
|
||||
$log.debug "Matched reference to issue #{issue} in milestone #{milestone}"
|
||||
forward_merges << ForwardMerge.new(issue, milestone, message, line)
|
||||
end
|
||||
end
|
||||
$log.debug "No match in merge message" unless forward_merges
|
||||
return forward_merges
|
||||
end
|
||||
|
||||
def get_issue(username, password, repository, number)
|
||||
$log.debug "Getting issue #{number} from GitHub repository #{repository}"
|
||||
uri = URI("https://api.github.com/repos/#{repository}/issues/#{number}")
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
http.use_ssl=true
|
||||
request = Net::HTTP::Get.new(uri.path)
|
||||
request.basic_auth(username, password)
|
||||
response = http.request(request)
|
||||
$log.debug "Get HTTP response #{response.code}"
|
||||
return JSON.parse(response.body) unless response.code != '200'
|
||||
puts "Failed to retrieve issue #{number}: #{response.message}"
|
||||
exit 1
|
||||
end
|
||||
|
||||
def find_milestone(username, password, repository, title)
|
||||
$log.debug "Finding milestone #{title} from GitHub repository #{repository}"
|
||||
uri = URI("https://api.github.com/repos/#{repository}/milestones")
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
http.use_ssl=true
|
||||
request = Net::HTTP::Get.new(uri.path)
|
||||
request.basic_auth(username, password)
|
||||
response = http.request(request)
|
||||
milestones = JSON.parse(response.body)
|
||||
if title.end_with?(".x")
|
||||
prefix = title.delete_suffix('.x')
|
||||
$log.debug "Finding nearest milestone from candidates starting with #{prefix}"
|
||||
titles = milestones.map { |milestone| milestone['title'] }
|
||||
titles = titles.select{ |title| title.start_with?(prefix) unless title.end_with?('.x')}
|
||||
titles = titles.sort_by { |v| Gem::Version.new(v) }
|
||||
$log.debug "Considering candidates #{titles}"
|
||||
if(titles.empty?)
|
||||
puts "Cannot find nearest milestone for prefix #{title}"
|
||||
exit 1
|
||||
end
|
||||
title = titles.first
|
||||
$log.debug "Found nearest milestone #{title}"
|
||||
end
|
||||
milestones.each do |milestone|
|
||||
$log.debug "Considering #{milestone['title']}"
|
||||
return milestone['number'] if milestone['title'] == title
|
||||
end
|
||||
puts "Milestone #{title} not found in #{repository}"
|
||||
exit 1
|
||||
end
|
||||
|
||||
def create_issue(username, password, repository, original, title, labels, milestone, milestone_name, dry_run)
|
||||
$log.debug "Finding forward-merge issue in GitHub repository #{repository} for '#{title}'"
|
||||
uri = URI("https://api.github.com/repos/#{repository}/issues")
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
http.use_ssl=true
|
||||
request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
|
||||
request.basic_auth(username, password)
|
||||
request.body = {
|
||||
title: title,
|
||||
labels: labels,
|
||||
milestone: milestone.to_i,
|
||||
body: "Forward port of issue ##{original} to #{milestone_name}."
|
||||
}.to_json
|
||||
if dry_run then
|
||||
puts "Dry run"
|
||||
puts "POSTing to #{uri} with body #{request.body}"
|
||||
return "dry-run"
|
||||
end
|
||||
response = JSON.parse(http.request(request).body)
|
||||
$log.debug "Created new issue #{response['number']}"
|
||||
return response['number']
|
||||
end
|
||||
|
||||
$log.debug "Running forward-merge hook script"
|
||||
message_file=ARGV[0]
|
||||
|
||||
forward_merges = find_forward_merges(message_file)
|
||||
exit 0 unless forward_merges
|
||||
|
||||
$log.debug "Loading config from ~/.spring-boot/forward_merge.yml"
|
||||
config = YAML.load_file(File.join(Dir.home, '.spring-boot', 'forward-merge.yml'))
|
||||
username = config['github']['credentials']['username']
|
||||
password = config['github']['credentials']['password']
|
||||
dry_run = config['dry_run']
|
||||
repository = 'spring-projects/spring-session'
|
||||
|
||||
forward_merges.each do |forward_merge|
|
||||
existing_issue = get_issue(username, password, repository, forward_merge.issue)
|
||||
title = existing_issue['title']
|
||||
labels = existing_issue['labels'].map { |label| label['name'] }
|
||||
labels << "status: forward-port"
|
||||
$log.debug "Processing issue '#{title}'"
|
||||
|
||||
milestone = find_milestone(username, password, repository, forward_merge.milestone)
|
||||
new_issue_number = create_issue(username, password, repository, forward_merge.issue, title, labels, milestone, forward_merge.milestone, dry_run)
|
||||
|
||||
puts "Created gh-#{new_issue_number} for forward port of gh-#{forward_merge.issue} into #{forward_merge.milestone}"
|
||||
rewritten_message = forward_merge.message.sub(forward_merge.line, "Closes gh-#{new_issue_number}\n")
|
||||
File.write(message_file, rewritten_message)
|
||||
end
|
||||
71
git/hooks/prepare-forward-merge
Executable file
71
git/hooks/prepare-forward-merge
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/ruby
|
||||
require 'json'
|
||||
require 'net/http'
|
||||
require 'yaml'
|
||||
require 'logger'
|
||||
|
||||
$main_branch = "3.0.x"
|
||||
|
||||
$log = Logger.new(STDOUT)
|
||||
$log.level = Logger::WARN
|
||||
|
||||
def get_fixed_issues()
|
||||
$log.debug "Searching for for forward merge"
|
||||
rev=`git rev-parse -q --verify MERGE_HEAD`.strip
|
||||
$log.debug "Found #{rev} from git rev-parse"
|
||||
return nil unless rev
|
||||
fixed = []
|
||||
message = `git log -1 --pretty=%B #{rev}`
|
||||
message.each_line do |line|
|
||||
$log.debug "Checking #{line} for message"
|
||||
fixed << line.strip if /^(?:Fixes|Closes) gh-(\d+)/.match(line)
|
||||
end
|
||||
$log.debug "Found fixed issues #{fixed}"
|
||||
return fixed;
|
||||
end
|
||||
|
||||
def rewrite_message(message_file, fixed)
|
||||
current_branch = `git rev-parse --abbrev-ref HEAD`.strip
|
||||
if current_branch == "main"
|
||||
current_branch = $main_branch
|
||||
end
|
||||
rewritten_message = ""
|
||||
message = File.read(message_file)
|
||||
message.each_line do |line|
|
||||
match = /^Merge.*branch\ '(.*)'(?:\ into\ (.*))?$/.match(line)
|
||||
if match
|
||||
from_branch = match[1]
|
||||
if from_branch.include? "/"
|
||||
from_branch = from_branch.partition("/").last
|
||||
end
|
||||
to_brach = match[2]
|
||||
$log.debug "Rewriting merge message"
|
||||
line = "Merge branch '#{from_branch}'" + (to_brach ? " into #{to_brach}\n" : "\n")
|
||||
end
|
||||
if fixed and line.start_with?("#")
|
||||
$log.debug "Adding fixed"
|
||||
rewritten_message << "\n"
|
||||
fixed.each do |fixes|
|
||||
rewritten_message << "#{fixes} in #{current_branch}\n"
|
||||
end
|
||||
fixed = nil
|
||||
end
|
||||
rewritten_message << line
|
||||
end
|
||||
return rewritten_message
|
||||
end
|
||||
|
||||
$log.debug "Running prepare-forward-merge hook script"
|
||||
|
||||
message_file=ARGV[0]
|
||||
message_type=ARGV[1]
|
||||
|
||||
if message_type != "merge"
|
||||
$log.debug "Not a merge commit"
|
||||
exit 0;
|
||||
end
|
||||
|
||||
$log.debug "Searching for for forward merge"
|
||||
fixed = get_fixed_issues()
|
||||
rewritten_message = rewrite_message(message_file, fixed)
|
||||
File.write(message_file, rewritten_message)
|
||||
@@ -1,3 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
org.gradle.parallel=true
|
||||
version=2.6.1
|
||||
version=2.7.1
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom 'io.projectreactor:reactor-bom:2020.0.14'
|
||||
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.0'
|
||||
mavenBom 'io.projectreactor:reactor-bom:2020.0.30'
|
||||
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.5'
|
||||
mavenBom 'org.junit:junit-bom:5.8.2'
|
||||
mavenBom 'org.springframework:spring-framework-bom:5.3.14'
|
||||
mavenBom 'org.springframework.data:spring-data-bom:2021.1.0'
|
||||
mavenBom 'org.springframework.security:spring-security-bom:5.6.1'
|
||||
mavenBom 'org.testcontainers:testcontainers-bom:1.16.2'
|
||||
mavenBom 'org.springframework:spring-framework-bom:5.3.26'
|
||||
mavenBom 'org.springframework.data:spring-data-bom:2021.2.9'
|
||||
mavenBom 'org.springframework.security:spring-security-bom:5.7.7'
|
||||
mavenBom 'org.testcontainers:testcontainers-bom:1.17.6'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -15,35 +15,35 @@ dependencyManagement {
|
||||
entry 'hazelcast-client'
|
||||
}
|
||||
|
||||
dependency 'org.aspectj:aspectjweaver:1.9.7'
|
||||
dependency 'ch.qos.logback:logback-core:1.2.9'
|
||||
dependency 'org.aspectj:aspectjweaver:1.9.9.1'
|
||||
dependency 'ch.qos.logback:logback-core:1.2.11'
|
||||
dependency 'com.google.code.findbugs:jsr305:3.0.2'
|
||||
dependency 'com.h2database:h2:1.4.200'
|
||||
dependency 'com.ibm.db2:jcc:11.5.6.0'
|
||||
dependency 'com.ibm.db2:jcc:11.5.8.0'
|
||||
dependency 'com.microsoft.sqlserver:mssql-jdbc:9.4.1.jre8'
|
||||
dependency 'com.oracle.database.jdbc:ojdbc8:21.3.0.0'
|
||||
dependency 'com.zaxxer:HikariCP:3.4.5'
|
||||
dependency 'com.oracle.database.jdbc:ojdbc8:21.5.0.0'
|
||||
dependency 'com.zaxxer:HikariCP:4.0.3'
|
||||
dependency 'edu.umd.cs.mtc:multithreadedtc:1.01'
|
||||
dependency 'io.lettuce:lettuce-core:6.1.5.RELEASE'
|
||||
dependency 'javax.annotation:javax.annotation-api:1.3.2'
|
||||
dependency 'javax.servlet:javax.servlet-api:4.0.1'
|
||||
dependency 'mysql:mysql-connector-java:8.0.27'
|
||||
dependency 'io.lettuce:lettuce-core:6.1.10.RELEASE'
|
||||
dependency 'jakarta.annotation:jakarta.annotation-api:1.3.5'
|
||||
dependency 'jakarta.servlet:jakarta.servlet-api:4.0.4'
|
||||
dependency 'mysql:mysql-connector-java:8.0.32'
|
||||
dependency 'org.apache.derby:derby:10.14.2.0'
|
||||
dependency 'org.assertj:assertj-core:3.21.0'
|
||||
dependency 'org.hamcrest:hamcrest:2.1'
|
||||
dependency 'org.assertj:assertj-core:3.22.0'
|
||||
dependency 'org.hamcrest:hamcrest:2.2'
|
||||
dependency 'org.hsqldb:hsqldb:2.5.2'
|
||||
dependency 'org.mariadb.jdbc:mariadb-java-client:2.7.4'
|
||||
dependencySet(group: 'org.mockito', version: '4.0.0') {
|
||||
dependency 'org.mariadb.jdbc:mariadb-java-client:2.7.8'
|
||||
dependencySet(group: 'org.mockito', version: '4.5.1') {
|
||||
entry 'mockito-core'
|
||||
entry 'mockito-junit-jupiter'
|
||||
}
|
||||
|
||||
dependencySet(group: 'org.mongodb', version: '4.4.0') {
|
||||
dependencySet(group: 'org.mongodb', version: '4.6.1') {
|
||||
entry 'mongodb-driver-core'
|
||||
entry 'mongodb-driver-sync'
|
||||
entry 'mongodb-driver-reactivestreams'
|
||||
}
|
||||
dependency 'org.postgresql:postgresql:42.3.1'
|
||||
dependency 'org.postgresql:postgresql:42.3.8'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "com.gradle.enterprise" version "3.5.1"
|
||||
id "com.gradle.enterprise" version "3.9"
|
||||
id "io.spring.ge.conventions" version "0.0.7"
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ dependencies {
|
||||
api "org.springframework:spring-jcl"
|
||||
|
||||
optional "io.projectreactor:reactor-core"
|
||||
optional "javax.annotation:javax.annotation-api"
|
||||
optional "javax.servlet:javax.servlet-api"
|
||||
optional "jakarta.annotation:jakarta.annotation-api"
|
||||
optional "jakarta.servlet:jakarta.servlet-api"
|
||||
optional "org.springframework:spring-context"
|
||||
optional "org.springframework:spring-jdbc"
|
||||
optional "org.springframework:spring-messaging"
|
||||
|
||||
@@ -41,5 +41,5 @@ dependencies {
|
||||
testImplementation "org.mockito:mockito-core"
|
||||
testImplementation "org.mockito:mockito-junit-jupiter"
|
||||
testImplementation "io.projectreactor:reactor-test"
|
||||
testImplementation "javax.servlet:javax.servlet-api"
|
||||
testImplementation "jakarta.servlet:jakarta.servlet-api"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -389,7 +389,7 @@ public abstract class AbstractMongoRepositoryITest extends AbstractITest {
|
||||
|
||||
protected static class BaseConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "mongo:4.0.10";
|
||||
private static final String DOCKER_IMAGE = "mongo:4.4.1";
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
public MongoDBContainer mongoContainer() {
|
||||
@@ -399,8 +399,8 @@ public abstract class AbstractMongoRepositoryITest extends AbstractITest {
|
||||
@Bean
|
||||
public MongoOperations mongoOperations(MongoDBContainer mongoContainer) {
|
||||
|
||||
MongoClient mongo = MongoClients.create(
|
||||
"mongodb://" + mongoContainer.getContainerIpAddress() + ":" + mongoContainer.getFirstMappedPort());
|
||||
MongoClient mongo = MongoClients
|
||||
.create("mongodb://" + mongoContainer.getHost() + ":" + mongoContainer.getFirstMappedPort());
|
||||
return new MongoTemplate(mongo, "test");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -175,7 +175,7 @@ public class MongoDbDeleteJacksonSessionVerificationTest {
|
||||
@EnableMongoWebSession
|
||||
static class Config {
|
||||
|
||||
private static final String DOCKER_IMAGE = "mongo:4.0.10";
|
||||
private static final String DOCKER_IMAGE = "mongo:4.4.1";
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
MongoDBContainer mongoContainer() {
|
||||
@@ -185,8 +185,8 @@ public class MongoDbDeleteJacksonSessionVerificationTest {
|
||||
@Bean
|
||||
ReactiveMongoOperations mongoOperations(MongoDBContainer mongoContainer) {
|
||||
|
||||
MongoClient mongo = MongoClients.create(
|
||||
"mongodb://" + mongoContainer.getContainerIpAddress() + ":" + mongoContainer.getFirstMappedPort());
|
||||
MongoClient mongo = MongoClients
|
||||
.create("mongodb://" + mongoContainer.getHost() + ":" + mongoContainer.getFirstMappedPort());
|
||||
return new ReactiveMongoTemplate(mongo, "DB_Name_DeleteJacksonSessionVerificationTest");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -170,7 +170,7 @@ public class MongoDbLogoutVerificationTest {
|
||||
@EnableMongoWebSession
|
||||
static class Config {
|
||||
|
||||
private static final String DOCKER_IMAGE = "mongo:4.0.10";
|
||||
private static final String DOCKER_IMAGE = "mongo:4.4.1";
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
MongoDBContainer mongoContainer() {
|
||||
@@ -180,8 +180,8 @@ public class MongoDbLogoutVerificationTest {
|
||||
@Bean
|
||||
ReactiveMongoOperations mongoOperations(MongoDBContainer mongoContainer) {
|
||||
|
||||
MongoClient mongo = MongoClients.create(
|
||||
"mongodb://" + mongoContainer.getContainerIpAddress() + ":" + mongoContainer.getFirstMappedPort());
|
||||
MongoClient mongo = MongoClients
|
||||
.create("mongodb://" + mongoContainer.getHost() + ":" + mongoContainer.getFirstMappedPort());
|
||||
return new ReactiveMongoTemplate(mongo, "test");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,10 +39,17 @@ import org.springframework.session.Session;
|
||||
public class MongoSession implements Session {
|
||||
|
||||
/**
|
||||
* Mongo doesn't support {@literal dot} in field names. We replace it with a very
|
||||
* rarely used character
|
||||
* Mongo doesn't support {@literal dot} in field names. We replace it with a unicode
|
||||
* character from the Private Use Area.
|
||||
* <p>
|
||||
* NOTE: This was originally stored in unicode format. Delomboking the code caused it
|
||||
* to get converted to another encoding, which isn't supported on all systems, so we
|
||||
* migrated back to unicode. The same character is being represented ensuring binary
|
||||
* compatibility.
|
||||
*
|
||||
* See https://www.compart.com/en/unicode/U+F607
|
||||
*/
|
||||
private static final char DOT_COVER_CHAR = '';
|
||||
private static final char DOT_COVER_CHAR = '\uF607';
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ dependencies {
|
||||
testImplementation "org.mockito:mockito-core"
|
||||
testImplementation "org.springframework:spring-test"
|
||||
testImplementation "io.projectreactor:reactor-test"
|
||||
testImplementation "javax.servlet:javax.servlet-api"
|
||||
testImplementation "jakarta.servlet:jakarta.servlet-api"
|
||||
testImplementation "org.springframework:spring-web"
|
||||
testImplementation "org.springframework.security:spring-security-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,7 +29,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
*/
|
||||
public abstract class AbstractRedisITests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
protected static class BaseConfig {
|
||||
|
||||
@@ -42,8 +42,8 @@ public abstract class AbstractRedisITests {
|
||||
|
||||
@Bean
|
||||
public LettuceConnectionFactory redisConnectionFactory() {
|
||||
RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration(
|
||||
redisContainer().getContainerIpAddress(), redisContainer().getFirstMappedPort());
|
||||
RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration(redisContainer().getHost(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(configuration);
|
||||
}
|
||||
|
||||
|
||||
@@ -527,6 +527,30 @@ class RedisIndexedSessionRepositoryITests extends AbstractRedisITests {
|
||||
assertThat(findByPrincipalName.keySet()).containsOnly(changeSessionId);
|
||||
}
|
||||
|
||||
@Test // gh-1987
|
||||
void changeSessionIdWhenPrincipalNameChangesFromNullThenIndexShouldNotBeCreated() {
|
||||
String principalName = null;
|
||||
String principalNameChanged = "findByChangedPrincipalName" + UUID.randomUUID();
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(INDEX_NAME, principalName);
|
||||
|
||||
this.repository.save(toSave);
|
||||
|
||||
RedisSession findById = this.repository.findById(toSave.getId());
|
||||
String changeSessionId = findById.changeSessionId();
|
||||
findById.setAttribute(INDEX_NAME, principalNameChanged);
|
||||
this.repository.save(findById);
|
||||
|
||||
Map<String, RedisSession> findByPrincipalName = this.repository.findByIndexNameAndIndexValue(INDEX_NAME,
|
||||
principalName);
|
||||
assertThat(findByPrincipalName).isEmpty();
|
||||
|
||||
findByPrincipalName = this.repository.findByIndexNameAndIndexValue(INDEX_NAME, principalNameChanged);
|
||||
|
||||
assertThat(findByPrincipalName).hasSize(1);
|
||||
assertThat(findByPrincipalName.keySet()).containsOnly(changeSessionId);
|
||||
}
|
||||
|
||||
@Test
|
||||
void changeSessionIdWhenOnlyChangeId() {
|
||||
String attrName = "changeSessionId";
|
||||
|
||||
@@ -858,11 +858,13 @@ public class RedisIndexedSessionRepository
|
||||
catch (NonTransientDataAccessException ex) {
|
||||
handleErrNoSuchKeyError(ex);
|
||||
}
|
||||
String originalPrincipalRedisKey = getPrincipalKey(this.originalPrincipalName);
|
||||
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
|
||||
.remove(this.originalSessionId);
|
||||
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
|
||||
.add(sessionId);
|
||||
if (this.originalPrincipalName != null) {
|
||||
String originalPrincipalRedisKey = getPrincipalKey(this.originalPrincipalName);
|
||||
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
|
||||
.remove(this.originalSessionId);
|
||||
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
|
||||
.add(sessionId);
|
||||
}
|
||||
}
|
||||
this.originalSessionId = sessionId;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,10 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class RedisSessionRepository implements SessionRepository<RedisSessionRepository.RedisSession> {
|
||||
|
||||
private static final String DEFAULT_KEY_NAMESPACE = "spring:session";
|
||||
/**
|
||||
* The default namespace for each key and channel in Redis used by Spring Session.
|
||||
*/
|
||||
public static final String DEFAULT_KEY_NAMESPACE = "spring:session";
|
||||
|
||||
private final RedisOperations<String, Object> sessionRedisOperations;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,11 +23,14 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -50,6 +53,15 @@ public class RedisHttpSessionConfigurationClassPathXmlApplicationContextTests {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,12 +21,17 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.session.data.redis.config.ConfigureRedisAction;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -52,7 +57,20 @@ class RedisHttpSessionConfigurationNoOpConfigureRedisActionTests {
|
||||
|
||||
@Bean
|
||||
RedisConnectionFactory redisConnectionFactory() {
|
||||
return mock(RedisConnectionFactory.class);
|
||||
RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class);
|
||||
RedisConnection connection = mock(RedisConnection.class);
|
||||
given(redisConnectionFactory.getConnection()).willReturn(connection);
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return redisConnectionFactory;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.session.data.redis.config.annotation.SpringSessionRedisOperations;
|
||||
@@ -34,8 +35,10 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -76,6 +79,15 @@ class RedisHttpSessionConfigurationOverrideDefaultSerializerTests {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,8 +27,8 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.scheduling.SchedulingAwareRunnable;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
@@ -36,6 +36,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -57,7 +58,7 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutor {
|
||||
|
||||
@Test
|
||||
void overrideSessionTaskExecutor() {
|
||||
verify(this.springSessionRedisTaskExecutor, times(1)).execute(any(SchedulingAwareRunnable.class));
|
||||
verify(this.springSessionRedisTaskExecutor, times(1)).execute(any(Runnable.class));
|
||||
}
|
||||
|
||||
@EnableRedisHttpSession
|
||||
@@ -66,7 +67,13 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutor {
|
||||
|
||||
@Bean
|
||||
Executor springSessionRedisTaskExecutor() {
|
||||
return mock(Executor.class);
|
||||
Executor executor = mock(Executor.class);
|
||||
willAnswer((it) -> {
|
||||
Runnable r = it.getArgument(0);
|
||||
new Thread(r).start();
|
||||
return null;
|
||||
}).given(executor).execute(any());
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -76,6 +83,15 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutor {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,8 +27,8 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.scheduling.SchedulingAwareRunnable;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
@@ -36,6 +36,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -62,7 +63,7 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutors {
|
||||
|
||||
@Test
|
||||
void overrideSessionTaskExecutors() {
|
||||
verify(this.springSessionRedisSubscriptionExecutor, times(1)).execute(any(SchedulingAwareRunnable.class));
|
||||
verify(this.springSessionRedisSubscriptionExecutor, times(1)).execute(any(Runnable.class));
|
||||
verify(this.springSessionRedisTaskExecutor, never()).execute(any(Runnable.class));
|
||||
}
|
||||
|
||||
@@ -72,12 +73,24 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutors {
|
||||
|
||||
@Bean
|
||||
Executor springSessionRedisTaskExecutor() {
|
||||
return mock(Executor.class);
|
||||
Executor executor = mock(Executor.class);
|
||||
willAnswer((it) -> {
|
||||
Runnable r = it.getArgument(0);
|
||||
new Thread(r).start();
|
||||
return null;
|
||||
}).given(executor).execute(any());
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean
|
||||
Executor springSessionRedisSubscriptionExecutor() {
|
||||
return mock(Executor.class);
|
||||
Executor executor = mock(Executor.class);
|
||||
willAnswer((it) -> {
|
||||
Runnable r = it.getArgument(0);
|
||||
new Thread(r).start();
|
||||
return null;
|
||||
}).given(executor).execute(any());
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -87,6 +100,15 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutors {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,6 +32,7 @@ import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.data.redis.core.RedisOperations;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.mock.env.MockEnvironment;
|
||||
@@ -47,8 +48,9 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -264,11 +266,24 @@ class RedisHttpSessionConfigurationTests {
|
||||
}
|
||||
|
||||
private static RedisConnectionFactory mockRedisConnectionFactory() {
|
||||
RedisConnectionFactory connectionFactory = mock(RedisConnectionFactory.class);
|
||||
RedisConnection connection = mock(RedisConnection.class);
|
||||
given(connectionFactory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
return connectionFactory;
|
||||
RedisConnectionFactory connectionFactoryMock = mock(RedisConnectionFactory.class);
|
||||
RedisConnection connectionMock = mock(RedisConnection.class);
|
||||
given(connectionFactoryMock.getConnection()).willReturn(connectionMock);
|
||||
|
||||
Properties keyspaceEventsConfig = new Properties();
|
||||
keyspaceEventsConfig.put("notify-keyspace-events", "KEA");
|
||||
given(connectionMock.getConfig("notify-keyspace-events")).willReturn(keyspaceEventsConfig);
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connectionMock).pSubscribe(any(), any());
|
||||
|
||||
return connectionFactoryMock;
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -445,7 +460,7 @@ class RedisHttpSessionConfigurationTests {
|
||||
|
||||
@Bean
|
||||
RedisMessageListenerContainer redisMessageListenerContainer() {
|
||||
return new RedisMessageListenerContainer();
|
||||
return mock(RedisMessageListenerContainer.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,12 +23,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@@ -46,6 +49,15 @@ public class RedisHttpSessionConfigurationXmlCustomExpireTests {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,12 +23,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@@ -46,6 +49,15 @@ public class RedisHttpSessionConfigurationXmlTests {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.data.redis.core.RedisOperations;
|
||||
import org.springframework.session.data.redis.RedisIndexedSessionRepository;
|
||||
import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration;
|
||||
@@ -33,8 +34,10 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -75,6 +78,14 @@ class Gh109Tests {
|
||||
RedisConnection connection = mock(RedisConnection.class);
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ content:
|
||||
- url: https://github.com/spring-io/spring-generated-docs
|
||||
branches: [spring-projects/spring-session/*]
|
||||
- url: https://github.com/spring-projects/spring-session
|
||||
branches: [main,3.0.x]
|
||||
tags: ['2.6.*','!2.6.0-M*','!2.6.0-RC*']
|
||||
branches: [main,3.0.x,2.6.x]
|
||||
tags: [ '3.0.*', '2.7.*', '2.6.*','!2.6.0-M*','!2.6.0-RC*','!2.7.0-M1','!3.0.0-M1']
|
||||
start_path: spring-session-docs
|
||||
urls:
|
||||
latest_version_segment_strategy: redirect:to
|
||||
@@ -21,7 +21,7 @@ ui:
|
||||
url: https://github.com/spring-io/antora-ui-spring/releases/download/latest/ui-bundle.zip
|
||||
snapshot: true
|
||||
|
||||
pipeline:
|
||||
antora:
|
||||
extensions:
|
||||
- require: ./antora/extensions/version-fix.js
|
||||
- require: ./antora/extensions/major-minor-segment.js
|
||||
- require: ./antora/extensions/root-component-name.js
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
name: ROOT
|
||||
version: '2.6.1'
|
||||
version: '2.7.1'
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
const { posix: path } = require('path')
|
||||
|
||||
module.exports.register = (pipeline, { config }) => {
|
||||
pipeline.on('contentClassified', ({ contentCatalog }) => {
|
||||
module.exports.register = function({ config }) {
|
||||
this.on('contentClassified', ({ contentCatalog }) => {
|
||||
contentCatalog.getComponents().forEach(component => {
|
||||
const componentName = component.name;
|
||||
const generationToVersion = new Map();
|
||||
@@ -91,6 +91,7 @@ function createSymbolicVersionAlias (component, version, symbolicVersionSegment,
|
||||
|
||||
function computeOut (src, family, version, htmlUrlExtensionStyle) {
|
||||
let { component, module: module_, basename, extname, relative, stem } = src
|
||||
if (component === 'ROOT') component = ''
|
||||
if (module_ === 'ROOT') module_ = ''
|
||||
let indexifyPathSegment = ''
|
||||
let familyPathSegment = ''
|
||||
@@ -120,8 +121,11 @@ function computePub (src, out, family, version, htmlUrlExtensionStyle) {
|
||||
const pub = {}
|
||||
let url
|
||||
if (family === 'nav') {
|
||||
const urlSegments = version ? [src.component, version] : [src.component]
|
||||
if (src.module && src.module !== 'ROOT') urlSegments.push(src.module)
|
||||
const component = src.component || 'ROOT'
|
||||
const urlSegments = component === 'ROOT' ? [] : [component]
|
||||
if (version) urlSegments.push(version)
|
||||
const module_ = src.module || 'ROOT'
|
||||
if (module_ !== 'ROOT') urlSegments.push(module_)
|
||||
// an artificial URL used for resolving page references in navigation model
|
||||
url = '/' + urlSegments.join('/') + '/'
|
||||
pub.moduleRootPath = '.'
|
||||
@@ -197,4 +201,4 @@ function no_data(key, value) {
|
||||
return value ? "__data__" : value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
// https://gitlab.com/antora/antora/-/issues/132#note_712132072
|
||||
'use strict'
|
||||
|
||||
const { posix: path } = require('path')
|
||||
|
||||
module.exports.register = (pipeline, { config }) => {
|
||||
pipeline.on('contentClassified', ({ contentCatalog }) => {
|
||||
const rootComponentName = config.rootComponentName || 'ROOT'
|
||||
const rootComponentNameLength = rootComponentName.length
|
||||
contentCatalog.findBy({ component: rootComponentName }).forEach((file) => {
|
||||
if (file.out) {
|
||||
file.out.dirname = file.out.dirname.substr(rootComponentNameLength)
|
||||
file.out.path = file.out.path.substr(rootComponentNameLength + 1)
|
||||
file.out.rootPath = fixPath(file.out.rootPath)
|
||||
}
|
||||
if (file.pub) {
|
||||
file.pub.url = file.pub.url.substr(rootComponentNameLength + 1)
|
||||
if (file.pub.rootPath) {
|
||||
file.pub.rootPath = fixPath(file.pub.rootPath)
|
||||
}
|
||||
}
|
||||
if (file.rel) {
|
||||
if (file.rel.pub) {
|
||||
file.rel.pub.url = file.rel.pub.url.substr(rootComponentNameLength + 1)
|
||||
file.rel.pub.rootPath = fixPath(file.rel.pub.rootPath);
|
||||
}
|
||||
}
|
||||
})
|
||||
const rootComponent = contentCatalog.getComponent(rootComponentName)
|
||||
rootComponent?.versions?.forEach((version) => {
|
||||
version.url = version.url.substr(rootComponentName.length + 1)
|
||||
})
|
||||
// const siteStartPage = contentCatalog.getById({ component: '', version: '', module: '', family: 'alias', relative: 'index.adoc' })
|
||||
// if (siteStartPage) delete siteStartPage.out
|
||||
})
|
||||
|
||||
function fixPath(path) {
|
||||
return path.split('/').slice(1).join('/') || '.'
|
||||
}
|
||||
}
|
||||
15
spring-session-docs/antora/extensions/version-fix.js
Normal file
15
spring-session-docs/antora/extensions/version-fix.js
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict'
|
||||
|
||||
module.exports.register = function({ config }) {
|
||||
|
||||
this.on('contentAggregated', ({ contentAggregate }) => {
|
||||
contentAggregate.forEach(aggregate => {
|
||||
if (aggregate.version === "2.6.2" &&
|
||||
aggregate.prerelease == "-SNAPSHOT") {
|
||||
aggregate.version = "2.6.2"
|
||||
aggregate.displayVersion = `${aggregate.version}`
|
||||
delete aggregate.prerelease
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -20,7 +20,7 @@ ui:
|
||||
url: https://github.com/spring-io/antora-ui-spring/releases/download/latest/ui-bundle.zip
|
||||
snapshot: true
|
||||
|
||||
pipeline:
|
||||
antora:
|
||||
extensions:
|
||||
- require: ./antora/extensions/version-fix.js
|
||||
- require: ./antora/extensions/major-minor-segment.js
|
||||
- require: ./antora/extensions/root-component-name.js
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,9 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.session.Session;
|
||||
import org.springframework.session.web.http.SessionRepositoryFilter;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -28,6 +30,9 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -47,7 +52,20 @@ public class HttpSessionConfigurationNoOpConfigureRedisActionXmlTests {
|
||||
}
|
||||
|
||||
static RedisConnectionFactory connectionFactory() {
|
||||
return mock(RedisConnectionFactory.class);
|
||||
RedisConnectionFactory connectionFactoryMock = mock(RedisConnectionFactory.class);
|
||||
RedisConnection connectionMock = mock(RedisConnection.class);
|
||||
given(connectionFactoryMock.getConnection()).willReturn(connectionMock);
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connectionMock).pSubscribe(any(), any());
|
||||
|
||||
return connectionFactoryMock;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,13 +21,18 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.session.data.redis.config.ConfigureRedisAction;
|
||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -55,7 +60,20 @@ class RedisHttpSessionConfigurationNoOpConfigureRedisActionTests {
|
||||
|
||||
@Bean
|
||||
RedisConnectionFactory redisConnectionFactory() {
|
||||
return mock(RedisConnectionFactory.class);
|
||||
RedisConnectionFactory connectionFactoryMock = mock(RedisConnectionFactory.class);
|
||||
RedisConnection connectionMock = mock(RedisConnection.class);
|
||||
given(connectionFactoryMock.getConnection()).willReturn(connectionMock);
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connectionMock).pSubscribe(any(), any());
|
||||
|
||||
return connectionFactoryMock;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.security.core.session.SessionDestroyedEvent;
|
||||
import org.springframework.session.MapSession;
|
||||
import org.springframework.session.Session;
|
||||
@@ -33,8 +34,10 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -67,6 +70,15 @@ public abstract class AbstractHttpSessionListenerTests {
|
||||
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ Spring Session provides `PrincipalNameExtractor` for this purpose.
|
||||
is not set, Hazelcast will serialize sessions using native Java serialization.
|
||||
<4> We create a `HazelcastInstance` that connects Spring Session to Hazelcast.
|
||||
By default, the application starts and connects to an embedded instance of Hazelcast.
|
||||
For more information on configuring Hazelcast, see the https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#hazelcast-configuration[reference documentation].
|
||||
For more information on configuring Hazelcast, see the https://docs.hazelcast.com/hazelcast/latest/[reference documentation].
|
||||
====
|
||||
|
||||
NOTE: If `HazelcastSessionSerializer` is preferred, it needs to be configured for all Hazelcast cluster members before they start.
|
||||
@@ -161,7 +161,7 @@ $ ./gradlew :spring-session-sample-javaconfig-hazelcast:tomcatRun
|
||||
====
|
||||
|
||||
NOTE: By default, Hazelcast runs in embedded mode with your application.
|
||||
However, if you want to connect to a standalone instance instead, you can configure it by following the instructions in the https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#hazelcast-configuration[reference documentation].
|
||||
However, if you want to connect to a standalone instance instead, you can configure it by following the instructions in the https://docs.hazelcast.com/hazelcast/latest/getting-started/get-started-cli[reference documentation].
|
||||
|
||||
You should now be able to access the application at http://localhost:8080/
|
||||
|
||||
@@ -188,9 +188,9 @@ You can view the cookies (with https://developers.google.com/web/tools/chrome-de
|
||||
|
||||
=== Interacting with the Data Store
|
||||
|
||||
You can remove the session by using https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#hazelcast-java-client[a Java client],
|
||||
https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#other-client-implementations[one of the other clients], or the
|
||||
https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#management-center[management center].
|
||||
You can remove the session by using https://docs.hazelcast.com/hazelcast/latest/clients/java[a Java client],
|
||||
https://hazelcast.com/clients/[one of the other clients], or the
|
||||
https://docs.hazelcast.com/management-center/latest/getting-started/overview[management center].
|
||||
|
||||
==== Using the Console
|
||||
|
||||
@@ -203,7 +203,7 @@ For example, to remove the session by using the management center console after
|
||||
----
|
||||
====
|
||||
|
||||
TIP: The Hazelcast documentation has instructions for https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#executing-console-commands[the console].
|
||||
TIP: The Hazelcast documentation has instructions for https://docs.hazelcast.com/hazelcast/latest/clients/clc[the console].
|
||||
|
||||
Alternatively, you can also delete the explicit key. Enter the following into the console, being sure to replace `7e8383a4-082c-4ffe-a4bc-c40fd3363c5e` with the value of your `SESSION` cookie:
|
||||
|
||||
@@ -218,7 +218,7 @@ Now visit the application at http://localhost:8080/ and observe that we are no l
|
||||
==== Using the REST API
|
||||
|
||||
As described in the section of the documentation that cover other clients, there is a
|
||||
https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#rest-client[REST API]
|
||||
https://docs.hazelcast.com/hazelcast/latest/clients/rest[REST API]
|
||||
provided by the Hazelcast node(s).
|
||||
|
||||
For example, you could delete an individual key as follows (being sure to replace `7e8383a4-082c-4ffe-a4bc-c40fd3363c5e` with the value of your SESSION cookie):
|
||||
|
||||
@@ -55,7 +55,10 @@ Spring Session is Open Source software released under the https://www.apache.org
|
||||
| Name | Location
|
||||
|
||||
| Spring Session Infinispan
|
||||
| https://infinispan.org/infinispan-spring-boot/master/spring_boot_starter.html#_enabling_spring_session_support
|
||||
| https://infinispan.org/docs/stable/titles/spring/spring.html
|
||||
|
||||
| Spring Session Caffeine
|
||||
| https://github.com/gotson/spring-session-caffeine
|
||||
|
||||
|===
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@ dependencies {
|
||||
testImplementation 'org.assertj:assertj-core'
|
||||
testImplementation 'com.hazelcast:hazelcast'
|
||||
testImplementation 'io.lettuce:lettuce-core'
|
||||
testImplementation 'javax.servlet:javax.servlet-api'
|
||||
testImplementation 'jakarta.servlet:jakarta.servlet-api'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
|
||||
}
|
||||
|
||||
antora {
|
||||
antoraVersion = "3.0.0-alpha.8"
|
||||
antoraVersion = "3.0.1"
|
||||
arguments = ["--fetch"]
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@ artifacts {
|
||||
|
||||
dependencies {
|
||||
api project(':spring-session-core')
|
||||
optional "com.hazelcast:hazelcast:4.2.3"
|
||||
optional "com.hazelcast:hazelcast:4.2.4"
|
||||
api "org.springframework:spring-context"
|
||||
api "javax.annotation:javax.annotation-api"
|
||||
api "jakarta.annotation:jakarta.annotation-api"
|
||||
|
||||
testImplementation "javax.servlet:javax.servlet-api"
|
||||
testImplementation "jakarta.servlet:jakarta.servlet-api"
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.mockito:mockito-core"
|
||||
testImplementation "org.springframework:spring-test"
|
||||
@@ -35,7 +35,7 @@ dependencies {
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
|
||||
|
||||
integrationTestCompile "org.testcontainers:testcontainers"
|
||||
integrationTestCompile "com.hazelcast:hazelcast:4.2.3"
|
||||
integrationTestCompile "com.hazelcast:hazelcast:4.2.4"
|
||||
integrationTestCompile project(":spring-session-hazelcast")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
||||
@WebAppConfiguration
|
||||
class ClientServerHazelcast4IndexedSessionRepositoryITests extends AbstractHazelcast4IndexedSessionRepositoryITests {
|
||||
|
||||
private static GenericContainer container = new GenericContainer<>("hazelcast/hazelcast:4.2.2")
|
||||
private static GenericContainer container = new GenericContainer<>("hazelcast/hazelcast:4.2.4")
|
||||
.withExposedPorts(5701).withCopyFileToContainer(MountableFile.forClasspathResource("/hazelcast-server.xml"),
|
||||
"/opt/hazelcast/hazelcast.xml");
|
||||
|
||||
@@ -66,8 +66,7 @@ class ClientServerHazelcast4IndexedSessionRepositoryITests extends AbstractHazel
|
||||
@Bean
|
||||
HazelcastInstance hazelcastInstance() {
|
||||
ClientConfig clientConfig = new ClientConfig();
|
||||
clientConfig.getNetworkConfig()
|
||||
.addAddress(container.getContainerIpAddress() + ":" + container.getFirstMappedPort());
|
||||
clientConfig.getNetworkConfig().addAddress(container.getHost() + ":" + container.getFirstMappedPort());
|
||||
clientConfig.getUserCodeDeploymentConfig().setEnabled(true).addClass(Session.class)
|
||||
.addClass(MapSession.class).addClass(Hazelcast4SessionUpdateEntryProcessor.class);
|
||||
return HazelcastClient.newHazelcastClient(clientConfig);
|
||||
|
||||
@@ -7,13 +7,13 @@ configurations {
|
||||
dependencies {
|
||||
api project(':spring-session-core')
|
||||
api "com.hazelcast:hazelcast"
|
||||
api "javax.annotation:javax.annotation-api"
|
||||
api "jakarta.annotation:jakarta.annotation-api"
|
||||
api "org.springframework:spring-context"
|
||||
|
||||
hazelcast4(project(path: ":hazelcast4", configuration: 'classesOnlyElements'))
|
||||
compileOnly(project(":hazelcast4"))
|
||||
|
||||
testImplementation "javax.servlet:javax.servlet-api"
|
||||
testImplementation "jakarta.servlet:jakarta.servlet-api"
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.mockito:mockito-core"
|
||||
testImplementation "org.springframework:spring-test"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -67,8 +67,7 @@ class ClientServerHazelcastIndexedSessionRepositoryITests extends AbstractHazelc
|
||||
@Bean
|
||||
HazelcastInstance hazelcastInstance() {
|
||||
ClientConfig clientConfig = new ClientConfig();
|
||||
clientConfig.getNetworkConfig()
|
||||
.addAddress(container.getContainerIpAddress() + ":" + container.getFirstMappedPort());
|
||||
clientConfig.getNetworkConfig().addAddress(container.getHost() + ":" + container.getFirstMappedPort());
|
||||
clientConfig.getUserCodeDeploymentConfig().setEnabled(true).addClass(Session.class)
|
||||
.addClass(MapSession.class).addClass(SessionUpdateEntryProcessor.class);
|
||||
return HazelcastClient.newHazelcastClient(clientConfig);
|
||||
|
||||
@@ -7,7 +7,7 @@ dependencies {
|
||||
api "org.springframework:spring-context"
|
||||
api "org.springframework:spring-jdbc"
|
||||
|
||||
testImplementation "javax.servlet:javax.servlet-api"
|
||||
testImplementation "jakarta.servlet:jakarta.servlet-api"
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.mockito:mockito-core"
|
||||
testImplementation "org.springframework:spring-test"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.session.jdbc;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.testcontainers.containers.Db2Container;
|
||||
import org.testcontainers.containers.JdbcDatabaseContainer;
|
||||
import org.testcontainers.containers.MSSQLServerContainer;
|
||||
@@ -25,7 +23,6 @@ import org.testcontainers.containers.MariaDBContainer;
|
||||
import org.testcontainers.containers.MySQLContainer;
|
||||
import org.testcontainers.containers.OracleContainer;
|
||||
import org.testcontainers.containers.PostgreSQLContainer;
|
||||
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
|
||||
|
||||
/**
|
||||
* Factories for various {@link JdbcDatabaseContainer}s.
|
||||
@@ -42,33 +39,19 @@ final class DatabaseContainers {
|
||||
}
|
||||
|
||||
static MariaDBContainer<?> mariaDb() {
|
||||
return new MariaDBContainer<>("mariadb:10.6.4");
|
||||
return new MariaDBContainer<>("mariadb:10.7.3");
|
||||
}
|
||||
|
||||
static MySQLContainer<?> mySql() {
|
||||
return new MySQLContainer<>("mysql:8.0.27");
|
||||
return new MySQLContainer<>("mysql:8.0.28");
|
||||
}
|
||||
|
||||
static OracleContainer oracle() {
|
||||
return new OracleContainer() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
this.waitStrategy = new LogMessageWaitStrategy().withRegEx(".*DATABASE IS READY TO USE!.*\\s")
|
||||
.withStartupTimeout(Duration.ofMinutes(10));
|
||||
addEnv("ORACLE_PWD", getPassword());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void waitUntilContainerStarted() {
|
||||
getWaitStrategy().waitUntilReady(this);
|
||||
}
|
||||
|
||||
};
|
||||
return new OracleContainer("gvenzl/oracle-xe:18.4.0-slim");
|
||||
}
|
||||
|
||||
static PostgreSQLContainer<?> postgreSql() {
|
||||
return new PostgreSQLContainer<>("postgres:14.0");
|
||||
return new PostgreSQLContainer<>("postgres:14.2");
|
||||
}
|
||||
|
||||
static MSSQLServerContainer<?> sqlServer() {
|
||||
|
||||
@@ -728,7 +728,8 @@ public class JdbcIndexedSessionRepository
|
||||
T attributeValue = supplier.get();
|
||||
if (attributeValue != null
|
||||
&& JdbcIndexedSessionRepository.this.saveMode.equals(SaveMode.ON_GET_ATTRIBUTE)) {
|
||||
this.delta.put(attributeName, DeltaValue.UPDATED);
|
||||
this.delta.merge(attributeName, DeltaValue.UPDATED, (oldDeltaValue,
|
||||
deltaValue) -> (oldDeltaValue == DeltaValue.ADDED) ? oldDeltaValue : deltaValue);
|
||||
}
|
||||
return attributeValue;
|
||||
}
|
||||
|
||||
@@ -655,6 +655,20 @@ class JdbcIndexedSessionRepositoryTests {
|
||||
verifyNoMoreInteractions(this.jdbcOperations);
|
||||
}
|
||||
|
||||
@Test
|
||||
void saveWithSaveModeOnGetAttributeAndNewAttributeSetAndGet() {
|
||||
this.repository.setSaveMode(SaveMode.ON_GET_ATTRIBUTE);
|
||||
MapSession delegate = new MapSession();
|
||||
delegate.setAttribute("attribute1", (Supplier<String>) () -> "value1");
|
||||
JdbcSession session = this.repository.new JdbcSession(delegate, UUID.randomUUID().toString(), false);
|
||||
session.setAttribute("attribute2", "value2");
|
||||
session.getAttribute("attribute2");
|
||||
this.repository.save(session);
|
||||
verify(this.jdbcOperations, times(1)).update(startsWith("INSERT INTO SPRING_SESSION_ATTRIBUTES ("),
|
||||
isA(PreparedStatementSetter.class));
|
||||
verifyNoMoreInteractions(this.jdbcOperations);
|
||||
}
|
||||
|
||||
@Test
|
||||
void saveWithSaveModeAlways() {
|
||||
this.repository.setSaveMode(SaveMode.ALWAYS);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.0'
|
||||
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.2.20220328'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
dependency 'ch.qos.logback:logback-classic:1.2.9'
|
||||
dependency 'com.maxmind.geoip2:geoip2:2.15.0'
|
||||
dependency 'ch.qos.logback:logback-classic:1.2.11'
|
||||
dependency 'com.maxmind.geoip2:geoip2:2.16.1'
|
||||
dependency 'javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.2'
|
||||
dependency 'javax.servlet.jsp:javax.servlet.jsp-api:2.3.3'
|
||||
dependency 'org.apache.taglibs:taglibs-standard-jstlel:1.2.5'
|
||||
dependency 'org.seleniumhq.selenium:htmlunit-driver:2.52.0'
|
||||
dependency 'org.slf4j:jcl-over-slf4j:1.7.32'
|
||||
dependency 'org.slf4j:log4j-over-slf4j:1.7.32'
|
||||
dependency 'org.seleniumhq.selenium:htmlunit-driver:3.61.0'
|
||||
dependency 'org.slf4j:jcl-over-slf4j:1.7.36'
|
||||
dependency 'org.slf4j:log4j-over-slf4j:1.7.36'
|
||||
dependency 'org.webjars:bootstrap:2.3.2'
|
||||
dependency 'org.webjars:html5shiv:3.7.3-1'
|
||||
dependency 'org.webjars:jquery:3.6.0'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -46,7 +46,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
|
||||
class FindByUsernameTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
@@ -115,8 +115,7 @@ class FindByUsernameTests {
|
||||
|
||||
@Bean
|
||||
LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ dependencies {
|
||||
implementation "org.springframework.boot:spring-boot-starter-actuator"
|
||||
implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
|
||||
implementation "org.springframework.boot:spring-boot-starter-security"
|
||||
implementation "com.hazelcast:hazelcast:4.2.3"
|
||||
implementation "com.hazelcast:hazelcast:4.2.4"
|
||||
implementation "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
|
||||
implementation "org.webjars:bootstrap"
|
||||
implementation "org.webjars:html5shiv"
|
||||
|
||||
@@ -2,3 +2,7 @@ logging:
|
||||
level:
|
||||
org.springframework.data.mongodb: DEBUG
|
||||
org.springframework.session: DEBUG
|
||||
spring:
|
||||
mongodb:
|
||||
embedded:
|
||||
version: 3.4.3
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
spring.thymeleaf.cache=false
|
||||
spring.template.cache=false
|
||||
spring.data.mongodb.port=0
|
||||
spring.mongodb.embedded.version=3.4.3
|
||||
|
||||
@@ -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>
|
||||
<title>Secured Content</title>
|
||||
</head>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:th="https://www.thymeleaf.org"
|
||||
xmlns:layout="https://github.com/ultraq/thymeleaf-layout-dialect">
|
||||
<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 th:href="@{/webjars/bootstrap/css/bootstrap.min.css}" href="/webjars/bootstrap/css/bootstrap.min.css" rel="stylesheet"></link>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@AutoConfigureMockMvc
|
||||
class HttpRedisJsonTest {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
@@ -115,8 +115,7 @@ class HttpRedisJsonTest {
|
||||
|
||||
@Bean
|
||||
LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@SpringBootTest
|
||||
class RedisSerializerTest {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@SpringSessionRedisOperations
|
||||
private RedisTemplate<Object, Object> sessionRedisTemplate;
|
||||
@@ -64,8 +64,7 @@ class RedisSerializerTest {
|
||||
|
||||
@Bean
|
||||
LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
|
||||
class BootTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
@@ -93,8 +93,7 @@ class BootTests {
|
||||
|
||||
@Bean
|
||||
LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
|
||||
class BootTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
@@ -97,8 +97,7 @@ class BootTests {
|
||||
|
||||
@Bean
|
||||
LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
class AttributeTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.9";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@LocalServerPort
|
||||
private int port;
|
||||
@@ -103,8 +103,7 @@ class AttributeTests {
|
||||
|
||||
@Bean
|
||||
LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
class AttributeTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@LocalServerPort
|
||||
private int port;
|
||||
@@ -105,8 +105,7 @@ class AttributeTests {
|
||||
|
||||
@Bean
|
||||
LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -52,7 +52,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
class ApplicationTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Value("${local.server.port}")
|
||||
private String port;
|
||||
@@ -86,8 +86,7 @@ class ApplicationTests {
|
||||
|
||||
@Bean
|
||||
LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,7 +38,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
*
|
||||
* @author Rob Winch
|
||||
*/
|
||||
@Entity
|
||||
@Entity(name = "custom_user")
|
||||
public class User implements Serializable {
|
||||
|
||||
@Id
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
insert into user(id,email,password,first_name,last_name) values (0,'rob','password','Rob','Winch');
|
||||
insert into user(id,email,password,first_name,last_name) values (1,'luke','password','Luke','Taylor');
|
||||
insert into user(id,email,password,first_name,last_name) values (2,'eve','password','Luke','Taylor');
|
||||
insert into custom_user(id,email,password,first_name,last_name) values (0,'rob','password','Rob','Winch');
|
||||
insert into custom_user(id,email,password,first_name,last_name) values (1,'luke','password','Luke','Taylor');
|
||||
insert into custom_user(id,email,password,first_name,last_name) values (2,'eve','password','Luke','Taylor');
|
||||
|
||||
update user set password = '$2a$10$FBAKClV1zBIOOC9XMXf3AO8RoGXYVYsfvUdoLxGkd/BnXEn4tqT3u';
|
||||
update custom_user set password = '$2a$10$FBAKClV1zBIOOC9XMXf3AO8RoGXYVYsfvUdoLxGkd/BnXEn4tqT3u';
|
||||
|
||||
@@ -17,7 +17,7 @@ dependencies {
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
implementation "org.testcontainers:testcontainers"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
@Profile("embedded-redis")
|
||||
public class EmbeddedRedisConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
@@ -40,8 +40,7 @@ public class EmbeddedRedisConfig {
|
||||
@Bean
|
||||
@Primary
|
||||
public LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ dependencies {
|
||||
implementation "org.slf4j:log4j-over-slf4j"
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
providedCompile "javax.servlet.jsp:javax.servlet.jsp-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
|
||||
@@ -16,7 +16,7 @@ dependencies {
|
||||
implementation "org.slf4j:log4j-over-slf4j"
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
|
||||
@@ -17,7 +17,7 @@ dependencies {
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
implementation "org.testcontainers:testcontainers"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
@Profile("embedded-redis")
|
||||
public class EmbeddedRedisConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
@@ -40,8 +40,7 @@ public class EmbeddedRedisConfig {
|
||||
@Bean
|
||||
@Primary
|
||||
public LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ dependencies {
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
implementation "org.testcontainers:testcontainers"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.springframework.security:spring-security-test"
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,7 +53,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
@WebAppConfiguration
|
||||
class RestMockMvcTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Autowired
|
||||
private SessionRepositoryFilter<? extends Session> sessionRepositoryFilter;
|
||||
@@ -99,8 +99,7 @@ class RestMockMvcTests {
|
||||
|
||||
@Bean
|
||||
LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
@Profile("embedded-redis")
|
||||
public class EmbeddedRedisConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
@@ -40,8 +40,7 @@ public class EmbeddedRedisConfig {
|
||||
@Bean
|
||||
@Primary
|
||||
public LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ dependencies {
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
implementation "org.testcontainers:testcontainers"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
providedCompile "javax.servlet.jsp:javax.servlet.jsp-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
@Profile("embedded-redis")
|
||||
public class EmbeddedRedisConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
@@ -40,8 +40,7 @@ public class EmbeddedRedisConfig {
|
||||
@Bean
|
||||
@Primary
|
||||
public LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ dependencies {
|
||||
implementation "org.slf4j:log4j-over-slf4j"
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
|
||||
@@ -16,7 +16,7 @@ dependencies {
|
||||
implementation "org.slf4j:log4j-over-slf4j"
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
|
||||
@@ -17,7 +17,7 @@ dependencies {
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
implementation "org.testcontainers:testcontainers"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
@Profile("embedded-redis")
|
||||
public class EmbeddedRedisConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
@@ -40,8 +40,7 @@ public class EmbeddedRedisConfig {
|
||||
@Bean
|
||||
@Primary
|
||||
public LettuceConnectionFactory redisConnectionFactory() {
|
||||
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
|
||||
redisContainer().getFirstMappedPort());
|
||||
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user