其他分享
首页 > 其他分享> > spring boot 单元测试

spring boot 单元测试

作者:互联网

import com.alibaba.dubbo.config.annotation.Reference;
import com.xxx.Application;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * 测试
 * @author bozi
 *
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes=Application.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)// 指定启动类
//@SpringBootTest(classes = {Application.class})// 指定启动类
//@EnableAutoConfiguration
public class DemoTest {

	@Autowired
	private TestService testService;
	
	@Reference
	private TestApiService testApiService;

	
	@Test
	public void testMythed() throws Exception {
		System.out.println("11111111111111");
	}
}

 

标签:Application,spring,boot,springframework,单元测试,SpringBootTest,org,import,class
来源: https://blog.csdn.net/xlb744868186/article/details/95923137