spring boot 测试用例,指定profile,随机端口

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;


@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(webEnvironment= RANDOM_PORT)
@ActiveProfiles(value= "dev")
@Slf4j
public class TestLogUtil {

    log.info("hello....");
}

 

你可能感兴趣的:(Spring)