THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||
---|---|---|
| ||
package sample.rs.service; import org.apache.cxf.jaxrs.client.WebClient; import org.apache.cxf.jaxrs.client.spring.EnableJaxRsWebClient; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @SpringBootApplication @EnableJaxRsWebClient public class SpringBootClientApplication { public static void main(String[] args) { SpringApplication.run(SpringBootClientApplication.class, args); } @Bean CommandLineRunner initWebClientRunner(final WebClient webClient) { return new CommandLineRunner() { @Override public void run(String... runArgs) throws Exception { System.out.println(webClient.path("sayHello/ApacheCxfWebClientUser").get(String.class)); } }; } } |
Configuration
Enabling ProxyClients
Code Block | ||
---|---|---|
| ||
package sample.rs.service;
import org.apache.cxf.jaxrs.client.spring.EnableJaxRsProxyClient;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import sample.rs.service.HelloService;
@SpringBootApplication
@EnableJaxRsProxyClient
public class SpringBootClientApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootClientApplication.class, args);
}
@Bean
CommandLineRunner initProxyClientRunner(final HelloService client) {
return new CommandLineRunner() {
@Override
public void run(String... runArgs) throws Exception {
System.out.println(client.sayHello("ApacheCxfProxyUser"));
}
};
}
}
|