Refactor code to remove compiler warnings

- replace setTrustResolver with setAuthorizationManagerFactory in MethodSecurityExpressionRootTests
- resolve raw type warning in ExpressionBasedMessageSecurityMetadataSourceFactoryTests

Closes gh-18412

Signed-off-by: Bae Jihong <dasog@naver.com>
This commit is contained in:
Bae Jihong 2026-02-15 22:54:48 +09:00 committed by Josh Cummings
parent 5a694869fa
commit bc4cc434fe
2 changed files with 6 additions and 3 deletions

View File

@ -27,6 +27,7 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.access.expression.ExpressionUtils;
import org.springframework.security.authentication.AuthenticationTrustResolver;
import org.springframework.security.authorization.DefaultAuthorizationManagerFactory;
import org.springframework.security.core.Authentication;
import static org.mockito.ArgumentMatchers.any;
@ -58,7 +59,9 @@ public class MethodSecurityExpressionRootTests {
this.ctx = new StandardEvaluationContext();
this.ctx.setRootObject(this.root);
this.trustResolver = mock(AuthenticationTrustResolver.class);
this.root.setTrustResolver(this.trustResolver);
DefaultAuthorizationManagerFactory<MethodInvocation> authorizationManagerFactory = new DefaultAuthorizationManagerFactory<>();
authorizationManagerFactory.setTrustResolver(this.trustResolver);
this.root.setAuthorizationManagerFactory(authorizationManagerFactory);
}
@Test

View File

@ -58,7 +58,7 @@ public class ExpressionBasedMessageSecurityMetadataSourceFactoryTests {
MessageSecurityMetadataSource source;
MessageSecurityExpressionRoot rootObject;
MessageSecurityExpressionRoot<Object> rootObject;
@BeforeEach
public void setup() {
@ -69,7 +69,7 @@ public class ExpressionBasedMessageSecurityMetadataSourceFactoryTests {
this.matcherToExpression.put(this.matcher2, this.expression2);
this.source = ExpressionBasedMessageSecurityMetadataSourceFactory
.createExpressionMessageMetadataSource(this.matcherToExpression);
this.rootObject = new MessageSecurityExpressionRoot(this.authentication, this.message);
this.rootObject = new MessageSecurityExpressionRoot<>(this.authentication, this.message);
}
@Test