QUERY=`cat <<'EOF'
select * from hoge_table
where id = 1
;
EOF`
まぁ、bash でいいじゃんという説も...。
QUERY=`cat <<'EOF'
select * from hoge_table
where id = 1
;
EOF`
java -jar foobar.jar --arg1=true --arg2=false
String command = System.getProperty("sun.java.command");
String[] args = command.split(" ", 0);
ConfigurableApplicationContext ctx = //どこかからapplicationContext取得
ConfigurableEnvironment ce = ctx.getEnvironment();
String arg = ce.getProperty("arg1");
// request factoryの生成 SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory() { }; // factoryになんかセットしたりする // リクエスト HttpEntity<String> request = new HttpEntity<String>(requestHeaders); String url = "https://localhost" RestTemplate restTemplate = new RestTemplate(factory); ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, request, String.class);
// request factoryの生成 HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(); SSLContext sslContext = null; try { sslContext = SSLContext.getInstance("TLSv1.2"); sslContext.init(null, null, null); } catch (Exception e) { //todo: } SSLConnectionSocketFactory sf = new SSLConnectionSocketFactory(sslContext); CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sf).setSSLHostnameVerifier(new NoopHostnameVerifier()).build(); factory.setHttpClient(httpClient); // リクエスト HttpEntity<String> request = new HttpEntity<String>(requestHeaders); String url = "https://localhost" RestTemplate restTemplate = new RestTemplate(factory); ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, request, String.class);