Browse Source

Remove deprecated `MemberCategory#DECLARED_FIELDS`

Issue gh-16889

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
pull/17202/head
Tran Ngoc Nhan 8 months ago committed by Josh Cummings
parent
commit
8e2067bb3e
  1. 4
      core/src/main/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrar.java
  2. 4
      core/src/main/java/org/springframework/security/aot/hint/CoreSecurityRuntimeHints.java
  3. 6
      core/src/test/java/org/springframework/security/aot/hint/CoreSecurityRuntimeHintsTests.java
  4. 8
      test/src/main/java/org/springframework/security/test/aot/hint/WebTestUtilsRuntimeHints.java
  5. 8
      test/src/test/java/org/springframework/security/test/aot/hint/WebTestUtilsRuntimeHintsTests.java
  6. 4
      web/src/main/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHints.java
  7. 4
      web/src/test/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHintsTests.java

4
core/src/main/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrar.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@ -122,7 +122,7 @@ public final class AuthorizeReturnObjectHintsRegistrar implements SecurityHintsR @@ -122,7 +122,7 @@ public final class AuthorizeReturnObjectHintsRegistrar implements SecurityHintsR
.registerType(clazz, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
MemberCategory.INVOKE_DECLARED_METHODS)
.registerType(proxied, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS);
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.ACCESS_DECLARED_FIELDS);
}
}

4
core/src/main/java/org/springframework/security/aot/hint/CoreSecurityRuntimeHints.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2025 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.
@ -79,7 +79,7 @@ class CoreSecurityRuntimeHints implements RuntimeHintsRegistrar { @@ -79,7 +79,7 @@ class CoreSecurityRuntimeHints implements RuntimeHintsRegistrar {
.registerTypes(
List.of(TypeReference.of(SecurityExpressionOperations.class),
TypeReference.of(SecurityExpressionRoot.class)),
(builder) -> builder.withMembers(MemberCategory.DECLARED_FIELDS,
(builder) -> builder.withMembers(MemberCategory.ACCESS_DECLARED_FIELDS,
MemberCategory.INVOKE_DECLARED_METHODS));
}

6
core/src/test/java/org/springframework/security/aot/hint/CoreSecurityRuntimeHintsTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2025 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.
@ -81,7 +81,7 @@ class CoreSecurityRuntimeHintsTests { @@ -81,7 +81,7 @@ class CoreSecurityRuntimeHintsTests {
void securityExpressionOperationsHasHints() {
assertThat(RuntimeHintsPredicates.reflection()
.onType(SecurityExpressionOperations.class)
.withMemberCategories(MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS))
.withMemberCategories(MemberCategory.ACCESS_DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS))
.accepts(this.hints);
}
@ -89,7 +89,7 @@ class CoreSecurityRuntimeHintsTests { @@ -89,7 +89,7 @@ class CoreSecurityRuntimeHintsTests {
void securityExpressionRootHasHints() {
assertThat(RuntimeHintsPredicates.reflection()
.onType(SecurityExpressionRoot.class)
.withMemberCategories(MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS))
.withMemberCategories(MemberCategory.ACCESS_DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS))
.accepts(this.hints);
}

8
test/src/main/java/org/springframework/security/test/aot/hint/WebTestUtilsRuntimeHints.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@ -58,12 +58,12 @@ class WebTestUtilsRuntimeHints implements RuntimeHintsRegistrar { @@ -58,12 +58,12 @@ class WebTestUtilsRuntimeHints implements RuntimeHintsRegistrar {
}
private void registerCsrfTokenRepositoryHints(RuntimeHints hints) {
hints.reflection().registerType(CsrfFilter.class, MemberCategory.DECLARED_FIELDS);
hints.reflection().registerType(CsrfFilter.class, MemberCategory.ACCESS_DECLARED_FIELDS);
}
private void registerSecurityContextRepositoryHints(RuntimeHints hints) {
hints.reflection().registerType(SecurityContextPersistenceFilter.class, MemberCategory.DECLARED_FIELDS);
hints.reflection().registerType(SecurityContextHolderFilter.class, MemberCategory.DECLARED_FIELDS);
hints.reflection().registerType(SecurityContextPersistenceFilter.class, MemberCategory.ACCESS_DECLARED_FIELDS);
hints.reflection().registerType(SecurityContextHolderFilter.class, MemberCategory.ACCESS_DECLARED_FIELDS);
}
}

8
test/src/test/java/org/springframework/security/test/aot/hint/WebTestUtilsRuntimeHintsTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@ -72,21 +72,21 @@ class WebTestUtilsRuntimeHintsTests { @@ -72,21 +72,21 @@ class WebTestUtilsRuntimeHintsTests {
void csrfFilterHasHints() {
assertThat(RuntimeHintsPredicates.reflection()
.onType(CsrfFilter.class)
.withMemberCategories(MemberCategory.DECLARED_FIELDS)).accepts(this.hints);
.withMemberCategories(MemberCategory.ACCESS_DECLARED_FIELDS)).accepts(this.hints);
}
@Test
void securityContextPersistenceFilterHasHints() {
assertThat(RuntimeHintsPredicates.reflection()
.onType(SecurityContextPersistenceFilter.class)
.withMemberCategories(MemberCategory.DECLARED_FIELDS)).accepts(this.hints);
.withMemberCategories(MemberCategory.ACCESS_DECLARED_FIELDS)).accepts(this.hints);
}
@Test
void securityContextHolderFilterHasHints() {
assertThat(RuntimeHintsPredicates.reflection()
.onType(SecurityContextHolderFilter.class)
.withMemberCategories(MemberCategory.DECLARED_FIELDS)).accepts(this.hints);
.withMemberCategories(MemberCategory.ACCESS_DECLARED_FIELDS)).accepts(this.hints);
}
}

4
web/src/main/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHints.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@ -36,7 +36,7 @@ class WebMvcSecurityRuntimeHints implements RuntimeHintsRegistrar { @@ -36,7 +36,7 @@ class WebMvcSecurityRuntimeHints implements RuntimeHintsRegistrar {
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
hints.reflection()
.registerType(WebSecurityExpressionRoot.class, (builder) -> builder
.withMembers(MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS));
.withMembers(MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.ACCESS_DECLARED_FIELDS));
hints.reflection()
.registerType(
TypeReference

4
web/src/test/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHintsTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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 @@ class WebMvcSecurityRuntimeHintsTests { @@ -50,7 +50,7 @@ class WebMvcSecurityRuntimeHintsTests {
void webSecurityExpressionRootHasHints() {
assertThat(RuntimeHintsPredicates.reflection()
.onType(WebSecurityExpressionRoot.class)
.withMemberCategories(MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS))
.withMemberCategories(MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.ACCESS_DECLARED_FIELDS))
.accepts(this.hints);
}

Loading…
Cancel
Save