Rench'

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
import java.util.Iterator;
import java.util.LinkedList;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"../../../../../spring.xml"})
public class AutoDown{
	
	@Autowired
	private JdbcTemplate jdbcTemplate;
	private static AutoDown autoDown;
	@PostConstruct
	public void init(){
		System.out.println("1111");
		autoDown = this;
		autoDown.jdbcTemplate = this.jdbcTemplate;
		System.out.println("init");
	}
	@Test
	public void testStatic(){
		System.out.println("11111111");
		System.out.println(autoDown.jdbcTemplate);
		int i = autoDown.jdbcTemplate.queryForObject("select count(1) from siminfo", Integer.class);
		System.out.println(i);
	}
	
		
}

  

posted on 2014-02-19 10:37  舞飞林  阅读(957)  评论(0编辑  收藏  举报