1
|
package eu.dnetlib.statsapi.repos;
|
2
|
|
3
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
|
4
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
5
|
import org.springframework.context.annotation.Bean;
|
6
|
import org.springframework.context.annotation.Configuration;
|
7
|
import org.springframework.context.annotation.Primary;
|
8
|
import org.springframework.stereotype.Component;
|
9
|
|
10
|
import javax.sql.DataSource;
|
11
|
|
12
|
/**
|
13
|
* Created by tsampikos on 8/3/2017.
|
14
|
*/
|
15
|
@Configuration
|
16
|
@Component
|
17
|
class DataSourceBean {
|
18
|
|
19
|
@ConfigurationProperties(prefix = "statsapi")
|
20
|
@Bean
|
21
|
@Primary
|
22
|
public DataSource getDataSource() {
|
23
|
return DataSourceBuilder
|
24
|
.create()
|
25
|
.build();
|
26
|
}
|
27
|
}
|