test config
This commit is contained in:
parent
4321b9255e
commit
134a1e887f
36
src/test/java/com/loafle/overflow/spring/AppConfigTest.java
Normal file
36
src/test/java/com/loafle/overflow/spring/AppConfigTest.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user