data connection fixed #10
Merged
chandrasegar
merged 1 commits from get_connection
into master
10 months ago
@ -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