Last active
April 29, 2020 02:02
-
-
Save CheolhoJeon/e073a4c6ac369564dda6ac5bd8f50309 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package config; | |
import org.apache.tomcat.jdbc.pool.DataSource; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
@Configuration | |
public class DsConfigWithProp { | |
@Value("${db.driver}") | |
private String driver; | |
@Value("${db.jdbcUrl}") | |
private String jdbcUrl; | |
@Value("${db.driver}") | |
private String user; | |
@Value("${db.driver}") | |
private String password; | |
@Bean(destroyMethod = "close") | |
public DataSource dataSource() { | |
DataSource ds = new DataSource(); | |
ds.setDriverClassName(driver); | |
ds.setUrl(jdbcUrl); | |
ds.setUsername(user); | |
ds.setPassword(password); | |
... | |
return ds; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment