File tree 1 file changed +30
-2
lines changed
docs/modules/ROOT/pages/reactive/test/web
1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
The basic setup looks like this:
4
4
5
- [source,java]
5
+ ====
6
+ .Java
7
+ [source,java,role="primary"]
6
8
----
7
9
@ExtendWith(SpringExtension.class)
8
10
@ContextConfiguration(classes = HelloWebfluxMethodApplication.class)
@@ -19,9 +21,35 @@ public class HelloWebfluxMethodApplicationTests {
19
21
// add Spring Security test Support
20
22
.apply(springSecurity())
21
23
.configureClient()
22
- .filter(basicAuthentication())
24
+ .filter(basicAuthentication("user", "password" ))
23
25
.build();
24
26
}
25
27
// ...
26
28
}
27
29
----
30
+
31
+ .Kotlin
32
+ [source,kotlin,role="secondary"]
33
+ ----
34
+ @ExtendWith(SpringExtension::class)
35
+ @ContextConfiguration(classes = [HelloWebfluxMethodApplication::class])
36
+ class HelloWebfluxMethodApplicationTests {
37
+ @Autowired
38
+ lateinit var context: ApplicationContext
39
+
40
+ lateinit var rest: WebTestClient
41
+
42
+ @BeforeEach
43
+ fun setup() {
44
+ this.rest = WebTestClient
45
+ .bindToApplicationContext(this.context)
46
+ // add Spring Security test Support
47
+ .apply(springSecurity())
48
+ .configureClient()
49
+ .filter(basicAuthentication("user", "password"))
50
+ .build()
51
+ }
52
+ // ...
53
+ }
54
+ ----
55
+ ====
You can’t perform that action at this time.
0 commit comments