test config

This commit is contained in:
geek 2017-08-08 17:57:20 +09:00
parent 4321b9255e
commit 134a1e887f

View File

@ -0,0 +1,36 @@
package com.loafle.overflow.spring;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.sql.DataSource;
import static org.junit.Assert.*;
/**
* Created by geek on 17. 8. 8.
*/
@Configuration
@Profile("test")
public class AppConfigTest {
@Autowired
private DataSource configureDataSource;
@Bean
public JdbcTemplate jdbcTemplate() {
JdbcTemplate template = new JdbcTemplate();
template.setDataSource(configureDataSource);
return template;
}
}