3
3
import org .slf4j .Logger ;
4
4
import org .slf4j .LoggerFactory ;
5
5
import org .springframework .beans .factory .annotation .Autowired ;
6
+ import org .springframework .beans .factory .annotation .Qualifier ;
6
7
import org .springframework .boot .CommandLineRunner ;
7
8
import org .springframework .boot .SpringApplication ;
8
9
import org .springframework .boot .autoconfigure .SpringBootApplication ;
@@ -29,8 +30,13 @@ public static void main(String... args) {
29
30
@ Component
30
31
public class Runner implements CommandLineRunner {
31
32
33
+ @ Qualifier ("insecureRSocketRequester" )
32
34
@ Autowired
33
- private RSocketRequester helloServiceRequester ;
35
+ private RSocketRequester insecureRSocketRequester ;
36
+
37
+ @ Qualifier ("secureRSocketRequester" )
38
+ @ Autowired
39
+ private RSocketRequester secureRSocketRequester ;
34
40
35
41
@ Override
36
42
public void run (String ... args ) throws Exception {
@@ -45,7 +51,7 @@ public void run(String... args) throws Exception {
45
51
LOG .info ("Sending message with Basic Auth metadata..." );
46
52
47
53
// Sending request to the hello-service
48
- String message = helloServiceRequester .route (params .method )
54
+ String message = secureRSocketRequester .route (params .method )
49
55
.metadata (new UsernamePasswordMetadata (params .username , params .password ), UsernamePasswordMetadata .BASIC_AUTHENTICATION_MIME_TYPE )
50
56
.data (params .name )
51
57
.retrieveMono (String .class )
@@ -59,7 +65,7 @@ public void run(String... args) throws Exception {
59
65
LOG .info ("Sending message without Basic Auth metadata..." );
60
66
61
67
// Sending request to the hello-service
62
- String message = helloServiceRequester .route (params .method )
68
+ String message = insecureRSocketRequester .route (params .method )
63
69
.data (params .name )
64
70
.retrieveMono (String .class )
65
71
.doOnError (throwable -> {
@@ -86,7 +92,7 @@ public static class ClientArguments {
86
92
/**
87
93
* Basic auth password
88
94
*/
89
- @ Option (names = "--password" , defaultValue = "basic auth password" )
95
+ @ Option (names = "--password" , description = "basic auth password" )
90
96
public String password ;
91
97
92
98
/**
0 commit comments