Skip to content

Instantly share code, notes, and snippets.

@joshlong
Created September 28, 2018 03:51
Show Gist options
  • Save joshlong/c5acc398a61ad7144d343dd8b3491784 to your computer and use it in GitHub Desktop.
Save joshlong/c5acc398a61ad7144d343dd8b3491784 to your computer and use it in GitHub Desktop.
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
// java Curl.java
public class Curl {
public static void main(String[] args) throws Exception {
URL url = new URL("https://start.spring.io/starter.zip?name=reservation-service-1" +
"&groupId=com.example&artifactId=reservation-service-1&version=0.0.1-SNAPSHOT&description=Demo+project+for+Spring+Boot&packageName=com.example.demo&type=maven-project&packaging=jar&javaVersion=1.8&language=java&" +
"bootVersion=2.0.5.RELEASE&dependencies=devtools&dependencies=data-mongodb-reactive" +
"&dependencies=actuator&dependencies=webflux");
try (InputStream inputStream = url.openStream();
OutputStream outputStream = new FileOutputStream(
new File(new File(System.getProperty("user.home"), "Desktop"), "reactive-spring.zip"))) {
inputStream.transferTo( outputStream);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment