@SpringBootApplication public class MainApplication { public static void main(String[] args) { RestTemplate template = new RestTemplate(); String url = ""; ResponseEntity res = template.exchange(url, HttpMethod.GET, new RequestEntity (null,null),String.class); System.out.println(res.getBody()); } } get请求,返回string类型 gradle.build配置文件
buildscript { ext { springBootVersion = '2.0.4.RELEASE' } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' //使用插件,将项目中引用jar包打进jar
jar { manifest { attributes 'Main-Class': 'test.MainApplication' } //into('lib') { // from configurations.runtime //} }