package io.swagger;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
@EnableSwagger2
public class Swagger2SpringBoot implements CommandLineRunner {

	@Override
	public void run(String... arg0) throws Exception {
		if (arg0.length > 0 && arg0[0].equals("exitcode")) {
			throw new ExitException();
		}
	}

	public static void main(String[] args) throws Exception {
		new SpringApplication(Swagger2SpringBoot.class).run(args);
	}

	class ExitException extends RuntimeException implements ExitCodeGenerator {
		private static final long serialVersionUID = 1L;

		@Override
		public int getExitCode() {
			return 10;
		}

	}
}

@@ -237,16 +237,120 @@
 ation;%0A%0A
+import org.springframework.context.annotation.Bean;%0Aimport org.springframework.web.client.RestTemplate;%0A
 import s
@@ -513,16 +513,94 @@
 nner %7B%0A%0A
+%09@Bean%0A%09public RestTemplate restTemplate() %7B%0A%09%09return new RestTemplate();%0A%09%7D%0A%0A
 %09@Overri

fix for "Could not autowire field: org.springframework.web.client.RestTemplate...." issue