Skip to content

Commit 936c4bf

Browse files
committed
Fix deprecation from Spring Security in HTTP module test
1 parent f276af9 commit 936c4bf

File tree

1 file changed

+5
-3
lines changed
  • spring-integration-http/src/test/java/org/springframework/integration/http/dsl

1 file changed

+5
-3
lines changed

Diff for: spring-integration-http/src/test/java/org/springframework/integration/http/dsl/HttpDslTests.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 the original author or authors.
2+
* Copyright 2016-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.
@@ -64,7 +64,6 @@
6464
import org.springframework.security.messaging.context.SecurityContextPropagationChannelInterceptor;
6565
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
6666
import org.springframework.security.web.SecurityFilterChain;
67-
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
6867
import org.springframework.test.annotation.DirtiesContext;
6968
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
7069
import org.springframework.test.web.client.MockMvcClientHttpRequestFactory;
@@ -80,6 +79,7 @@
8079
import org.springframework.web.multipart.support.StandardServletMultipartResolver;
8180
import org.springframework.web.server.ResponseStatusException;
8281
import org.springframework.web.servlet.DispatcherServlet;
82+
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
8383

8484
import static org.assertj.core.api.Assertions.assertThat;
8585
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.httpBasic;
@@ -211,6 +211,7 @@ public void testMultiPartFiles() throws Exception {
211211
}
212212

213213
@Autowired
214+
@Qualifier("customValidator")
214215
private Validator validator;
215216

216217
@Test
@@ -299,6 +300,7 @@ protected Object handleRequestMessage(Message<?> requestMessage) {
299300
@Configuration
300301
@EnableWebSecurity
301302
@EnableIntegration
303+
@EnableWebMvc
302304
public static class ContextConfiguration {
303305

304306
@Bean
@@ -327,7 +329,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
327329
return http
328330
.authorizeHttpRequests((authorizeHttpRequests) ->
329331
authorizeHttpRequests
330-
.requestMatchers(new AntPathRequestMatcher("/service/internal/**")).hasRole("ADMIN")
332+
.requestMatchers("/service/internal/**").hasRole("ADMIN")
331333
.anyRequest().permitAll())
332334
.httpBasic(Customizer.withDefaults())
333335
.csrf(AbstractHttpConfigurer::disable)

0 commit comments

Comments
 (0)