File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import org .springframework .boot .autoconfigure .SpringBootApplication ;
55import org .springframework .boot .builder .SpringApplicationBuilder ;
66import org .springframework .boot .context .web .SpringBootServletInitializer ;
7+ import org .springframework .context .annotation .Bean ;
8+ import org .springframework .web .client .RestTemplate ;
79
810@ SpringBootApplication
911public class SpringDemoApplication extends SpringBootServletInitializer {
@@ -16,4 +18,9 @@ public static void main(String[] args) {
1618 protected SpringApplicationBuilder configure (SpringApplicationBuilder application ) {
1719 return application .sources (SpringDemoApplication .class );
1820 }
21+
22+ @ Bean
23+ public RestTemplate getRestTemplate (){
24+ return new RestTemplate ();
25+ }
1926}
Original file line number Diff line number Diff line change 44import java .util .HashMap ;
55import java .util .Map ;
66
7+ import org .springframework .beans .factory .annotation .Autowired ;
78import org .springframework .boot .test .IntegrationTest ;
89import org .springframework .boot .test .SpringApplicationContextLoader ;
910import org .springframework .http .HttpMethod ;
2122public class SpringIntegrationTest {
2223 protected static ResponseResults latestResponse = null ;
2324
24- protected RestTemplate restTemplate = null ;
25+ @ Autowired
26+ protected RestTemplate restTemplate ;
2527
2628 protected void executeGet (String url ) throws IOException {
2729 final Map <String , String > headers = new HashMap <>();
You can’t perform that action at this time.
0 commit comments