Skip to content

Instantly share code, notes, and snippets.

View alamer's full-sized avatar

Ivan Scherbakov alamer

  • Irkutsk
View GitHub Profile
@alamer
alamer / DataSourceConfig.java
Last active February 20, 2019 07:56
Datasource configuration class
package com.example.demo.config;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
JsonProcedureExtractor extractor = JsonProcedureExtractor.newBuilder()
.withParams(
new JdbcParameter<Long>("maxValue", JdbcParamType.IN_NUMBER, Long.valueOf(1)),
new JdbcParameter<Object>("maxValue", JdbcParamType.OUT_CURSOR)
)
.withStoredProcedure("{call terra.pkg_tsod3_inv.report(?,?,?)}")
.build();
HttpPost request = new HttpPost(m.getRequestURL());
request.addHeader("content-type", "application/json; charset=UTF-8");
System.out.println(m.getAuthKey());
request.addHeader("Authorization", "Basic " + m.getAuthKey());
StringEntity params = new StringEntity(m.getBody(),"UTF-8");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);