Skip to content

Commit 6de5009

Browse files
marcusdacoregiorwinch
authored andcommitted
Upgrade to JDK 17
Closes gh-10343
1 parent 189ad4a commit 6de5009

File tree

12 files changed

+22
-26
lines changed

12 files changed

+22
-26
lines changed

README.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ image:https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?l
66

77
= Spring Security
88

9-
Spring Security provides security services for the https://docs.spring.io[Spring IO Platform]. Spring Security 5.0 requires Spring 5.0 as
10-
a minimum and also requires Java 8.
9+
Spring Security provides security services for the https://docs.spring.io[Spring IO Platform]. Spring Security 6.0 requires Spring 6.0 as
10+
a minimum and also requires Java 17.
1111

1212
For a detailed list of features and access to the latest release, please visit https://spring.io/projects[Spring projects].
1313

@@ -30,9 +30,9 @@ In the instructions below, https://vimeo.com/34436402[`./gradlew`] is invoked fr
3030
a cross-platform, self-contained bootstrap mechanism for the build.
3131

3232
=== Prerequisites
33-
https://help.github.com/set-up-git-redirect[Git] and the https://www.oracle.com/technetwork/java/javase/downloads[JDK11 build].
33+
https://help.github.com/set-up-git-redirect[Git] and the https://www.oracle.com/technetwork/java/javase/downloads[JDK17 build].
3434

35-
Be sure that your `JAVA_HOME` environment variable points to the `jdk-11` folder extracted from the JDK download.
35+
Be sure that your `JAVA_HOME` environment variable points to the `jdk-17` folder extracted from the JDK download.
3636

3737
=== Check out sources
3838
[indent=0]

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ updateDependenciesSettings {
100100

101101
subprojects {
102102
plugins.withType(JavaPlugin) {
103-
project.sourceCompatibility='1.8'
103+
project.sourceCompatibility=JavaVersion.VERSION_17
104104
}
105105
tasks.withType(JavaCompile) {
106106
options.encoding = "UTF-8"

buildSrc/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ plugins {
55
id 'com.apollographql.apollo' version '2.4.5'
66
}
77

8-
9-
sourceCompatibility = 1.8
8+
sourceCompatibility = JavaVersion.VERSION_11
109

1110
repositories {
1211
jcenter()

buildSrc/src/main/groovy/io/spring/gradle/convention/JacocoPlugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class JacocoPlugin implements Plugin<Project> {
3434
project.tasks.check.dependsOn project.tasks.jacocoTestReport
3535

3636
project.jacoco {
37-
toolVersion = '0.8.2'
37+
toolVersion = '0.8.7'
3838
}
3939
}
4040
}

buildSrc/src/test/java/io/spring/gradle/convention/JavadocApiPluginITest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.gradle.testkit.runner.BuildResult;
66
import org.gradle.testkit.runner.TaskOutcome;
77
import org.junit.jupiter.api.BeforeEach;
8+
import org.junit.jupiter.api.Disabled;
89
import org.junit.jupiter.api.Test;
910
import org.junit.jupiter.api.io.TempDir;
1011

@@ -28,7 +29,7 @@ public void multiModuleApi() throws Exception {
2829
.build();
2930
assertThat(result.task(":api").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
3031
File allClasses = new File(testKit.getRootDir(), "build/api/allclasses-noframe.html");
31-
File index = new File(testKit.getRootDir(), "build/api/allclasses.html");
32+
File index = new File(testKit.getRootDir(), "build/api/allclasses-index.html");
3233
File listing = allClasses.exists() ? allClasses : index;
3334
String listingText = FileUtils.readFileToString(listing);
3435
assertThat(listingText).contains("sample/Api.html");

config/spring-security-config.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ tasks.withType(KotlinCompile).configureEach {
117117
languageVersion = "1.3"
118118
apiVersion = "1.3"
119119
freeCompilerArgs = ["-Xjsr305=strict", "-Xsuppress-version-warnings"]
120-
jvmTarget = "1.8"
120+
jvmTarget = "11"
121121
}
122122
}
123123

config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpX509Tests.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
import java.security.cert.CertificateFactory;
2222
import java.security.cert.X509Certificate;
2323

24+
import javax.security.auth.x500.X500Principal;
2425
import javax.servlet.http.HttpServletRequest;
2526

27+
import org.bouncycastle.asn1.x500.X500Name;
28+
import org.bouncycastle.asn1.x500.style.BCStyle;
2629
import org.junit.jupiter.api.Test;
2730
import org.junit.jupiter.api.extension.ExtendWith;
28-
import sun.security.x509.X500Name;
2931

3032
import org.springframework.beans.factory.annotation.Autowired;
3133
import org.springframework.context.annotation.Bean;
@@ -240,12 +242,8 @@ protected void configure(HttpSecurity http) throws Exception {
240242
}
241243

242244
private String extractCommonName(X509Certificate certificate) {
243-
try {
244-
return ((X500Name) certificate.getSubjectDN()).getCommonName();
245-
}
246-
catch (Exception ex) {
247-
throw new IllegalArgumentException(ex);
248-
}
245+
X500Principal principal = certificate.getSubjectX500Principal();
246+
return new X500Name(principal.getName()).getRDNs(BCStyle.CN)[0].getFirst().getValue().toString();
249247
}
250248

251249
}

config/src/test/java/org/springframework/security/config/web/server/OAuth2ResourceServerSpecTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
import org.springframework.security.web.server.authentication.HttpStatusServerEntryPoint;
7171
import org.springframework.security.web.server.authentication.ServerAuthenticationConverter;
7272
import org.springframework.security.web.server.authorization.HttpStatusServerAccessDeniedHandler;
73-
import org.springframework.test.context.junit.jupiter.SpringExtension;
7473
import org.springframework.test.web.reactive.server.WebTestClient;
7574
import org.springframework.web.bind.annotation.GetMapping;
7675
import org.springframework.web.bind.annotation.PostMapping;
@@ -93,7 +92,7 @@
9392
* Tests for
9493
* {@link org.springframework.security.config.web.server.ServerHttpSecurity.OAuth2ResourceServerSpec}
9594
*/
96-
@ExtendWith({ SpringExtension.class, SpringTestContextExtension.class })
95+
@ExtendWith({ SpringTestContextExtension.class })
9796
public class OAuth2ResourceServerSpecTests {
9897

9998
private String expired = "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE1MzUwMzc4OTd9.jqZDDjfc2eysX44lHXEIr9XFd2S8vjIZHCccZU-dRWMRJNsQ1QN5VNnJGklqJBXJR4qgla6cmVqPOLkUHDb0sL0nxM5XuzQaG5ZzKP81RV88shFyAiT0fD-6nl1k-Fai-Fu-VkzSpNXgeONoTxDaYhdB-yxmgrgsApgmbOTE_9AcMk-FQDXQ-pL9kynccFGV0lZx4CA7cyknKN7KBxUilfIycvXODwgKCjj_1WddLTCNGYogJJSg__7NoxzqbyWd3udbHVjqYq7GsMMrGB4_2kBD4CkghOSNcRHbT_DIXowxfAVT7PAg7Q0E5ruZsr2zPZacEUDhJ6-wbvlA0FAOUg";

core/src/test/java/org/springframework/security/core/JavaVersionTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
2929
*/
3030
public class JavaVersionTests {
3131

32-
private static final int JDK8_CLASS_VERSION = 52;
32+
private static final int JDK17_CLASS_VERSION = 61;
3333

3434
@Test
3535
public void authenticationCorrectJdkCompatibility() throws Exception {
@@ -44,7 +44,7 @@ private void assertClassVersion(Class<?> clazz) throws Exception {
4444
data.readInt();
4545
data.readShort(); // minor
4646
int major = data.readShort();
47-
assertThat(major).isEqualTo(JDK8_CLASS_VERSION);
47+
assertThat(major).isEqualTo(JDK17_CLASS_VERSION);
4848
}
4949
}
5050

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ openSamlVersion=3.4.6
66
version=6.0.0-SNAPSHOT
77
kotlinVersion=1.5.31
88
samplesBranch=main
9-
org.gradle.jvmargs=-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError
9+
org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError
1010
org.gradle.parallel=true
1111
org.gradle.caching=true
1212
kotlin.stdlib.default.dependency=false

oauth2/oauth2-client/spring-security-oauth2-client.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ dependencies {
2121
testImplementation 'com.squareup.okhttp3:mockwebserver'
2222
testImplementation 'io.projectreactor.netty:reactor-netty'
2323
testImplementation 'io.projectreactor:reactor-test'
24-
testImplementation 'io.projectreactor.tools:blockhound'
2524
testImplementation 'org.skyscreamer:jsonassert'
2625
testImplementation 'io.r2dbc:r2dbc-h2:0.8.4.RELEASE'
2726
testImplementation 'io.r2dbc:r2dbc-spi-test:0.8.6.RELEASE'

saml2/saml2-service-provider/spring-security-saml2-service-provider.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ configurations {
3636
}
3737

3838
compileOpensaml4MainJava {
39-
sourceCompatibility = '11'
40-
targetCompatibility = '11'
39+
sourceCompatibility = JavaVersion.VERSION_17
40+
targetCompatibility = JavaVersion.VERSION_17
4141
}
4242

4343
dependencies {

0 commit comments

Comments
 (0)