Skip to content

Commit c972de5

Browse files
committed
Use .equals to Compare Methods
Closes gh-17143
1 parent 6fb0591 commit c972de5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

aspects/src/test/java/org/springframework/security/authorization/method/aspectj/PreAuthorizeAspectTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -144,7 +144,7 @@ private void privateMethod() {
144144
protected void protectedMethod() {
145145
}
146146

147-
@PreAuthorize("hasRole('X')")
147+
@PreAuthorize("hasRole('A')")
148148
void publicCallsPrivate() {
149149
privateMethod();
150150
}

core/src/main/java/org/springframework/security/core/annotation/UniqueSecurityAnnotationScanner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -267,7 +267,7 @@ private List<MergedAnnotation<A>> findDirectAnnotations(AnnotatedElement element
267267

268268
private static Method findMethod(Method method, Class<?> targetClass) {
269269
for (Method candidate : targetClass.getDeclaredMethods()) {
270-
if (candidate == method) {
270+
if (candidate.equals(method)) {
271271
return candidate;
272272
}
273273
if (isOverride(method, candidate)) {

0 commit comments

Comments
 (0)