spring-security/docs/modules/ROOT/pages/reactive/test/web/setup.adoc

28 lines
564 B
Plaintext
Raw Normal View History

= WebTestClient Security Setup
The basic setup looks like this:
[source,java]
----
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = HelloWebfluxMethodApplication.class)
public class HelloWebfluxMethodApplicationTests {
@Autowired
ApplicationContext context;
WebTestClient rest;
@BeforeEach
public void setup() {
this.rest = WebTestClient
.bindToApplicationContext(this.context)
// add Spring Security test Support
.apply(springSecurity())
.configureClient()
.filter(basicAuthentication())
.build();
}
// ...
}
----