1
|
package eu.dnetlib;
|
2
|
|
3
|
import org.apache.commons.dbcp2.BasicDataSource;
|
4
|
import org.springframework.beans.factory.annotation.Value;
|
5
|
import org.springframework.context.annotation.Bean;
|
6
|
import org.springframework.context.annotation.Configuration;
|
7
|
|
8
|
/**
|
9
|
* Created by Alessia Bardi on 31/03/17.
|
10
|
*
|
11
|
* @author Alessia Bardi
|
12
|
*/
|
13
|
@Configuration
|
14
|
public class ProjectsExporterConfig {
|
15
|
|
16
|
private String driverClassName = "org.postgresql.Driver";
|
17
|
|
18
|
@Value("${openaire.exporter.jdbc.url}")
|
19
|
private String jdbcUrl;
|
20
|
@Value("${openaire.exporter.jdbc.user}")
|
21
|
private String jdbcUser;
|
22
|
@Value("${openaire.exporter.jdbc.pwd}")
|
23
|
private String jdbcPwd;
|
24
|
@Value("${openaire.exporter.jdbc.minIdle}")
|
25
|
private int jdbcMinIdle;
|
26
|
@Value("${openaire.exporter.jdbc.maxIdle}")
|
27
|
private int jdbcMaxidle;
|
28
|
|
29
|
@Bean(name = "apiDataSource")
|
30
|
public BasicDataSource getApiDataSource() {
|
31
|
BasicDataSource d = new BasicDataSource();
|
32
|
d.setDriverClassName(driverClassName);
|
33
|
d.setUrl(jdbcUrl);
|
34
|
d.setUsername(jdbcUser);
|
35
|
d.setPassword(jdbcPwd);
|
36
|
d.setMinIdle(jdbcMinIdle);
|
37
|
d.setMaxIdle(jdbcMaxidle);
|
38
|
return d;
|
39
|
}
|
40
|
|
41
|
|
42
|
|
43
|
}
|