Merge pull request 'data connection fixed' (#10) from get_connection into master
Reviewed-on: #10master
commit
10c621ed40
@ -0,0 +1,35 @@
|
||||
package entgra.mailsender.Config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
public class DataSourceConfig {
|
||||
@Value("${spring.datasource.url}")
|
||||
private String dbUrl;
|
||||
|
||||
@Value("${spring.datasource.username}")
|
||||
private String dbUserName;
|
||||
|
||||
@Value("${spring.datasource.password}")
|
||||
private String dbPassword;
|
||||
|
||||
@Value("${spring.datasource.driver-class-name}")
|
||||
private String dbDriver;
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public DataSource dataSource(){
|
||||
return DataSourceBuilder.create()
|
||||
.url(dbUrl)
|
||||
.username(dbUserName)
|
||||
.password(dbPassword)
|
||||
.driverClassName(dbDriver)
|
||||
.build();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue