개발/스프링
JavaConfig 예제 (dataSource)
로그인시러
2016. 10. 27. 15:27
package com.terry.boardprj.common; import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class BoardConfig { @Bean(destroyMethod="close") public DataSource dataSource(){ BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver"); dataSource.setUrl("jdbc:oracle:thin:@localhost:1521:orcl"); dataSource.setUsername("study"); dataSource.setPassword("study"); dataSource.setDefaultAutoCommit(false); return dataSource; } }