I rewrote the document and the code (mostly changing package names) to use the Spring Initializr. I also modified the build files to use Spring Boot 2.2.0, which necessitated replacing the Gradle wrappers. Note that there are no tests (other than the one I pulled in from the src directory that the Initializr created).
32 lines
819 B
Java
32 lines
819 B
Java
|
|
package com.example.consumingwebservice;
|
|
|
|
import org.springframework.boot.CommandLineRunner;
|
|
import org.springframework.boot.SpringApplication;
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import com.example.consumingwebservice.wsdl.GetCountryResponse;
|
|
|
|
@SpringBootApplication
|
|
public class ConsumingWebServiceApplication {
|
|
|
|
public static void main(String[] args) {
|
|
SpringApplication.run(ConsumingWebServiceApplication.class, args);
|
|
}
|
|
|
|
@Bean
|
|
CommandLineRunner lookup(CountryClient quoteClient) {
|
|
return args -> {
|
|
String country = "Spain";
|
|
|
|
if (args.length > 0) {
|
|
country = args[0];
|
|
}
|
|
GetCountryResponse response = quoteClient.getCountry(country);
|
|
System.err.println(response.getCountry().getCurrency());
|
|
};
|
|
}
|
|
|
|
}
|