Add @LocalServerPort

Closes gh-5262
This commit is contained in:
Anand Shah
2016-03-01 16:02:41 +00:00
committed by Stephane Nicoll
parent a3a38c6bbc
commit f6a32a1d5a
19 changed files with 134 additions and 22 deletions

View File

@@ -23,6 +23,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.bind.LocalServerPort;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.test.SpringApplicationIntegrationTestTests.Config;
@@ -54,7 +55,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@IntegrationTest({ "server.port=0", "value=123" })
public class SpringApplicationIntegrationTestTests {
@Value("${local.server.port}")
@LocalServerPort
private int port = 0;
@Value("${value}")

View File

@@ -23,6 +23,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.bind.LocalServerPort;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.test.SpringApplicationWebIntegrationTestTests.Config;
@@ -52,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebIntegrationTest({ "server.port=0", "value=123" })
public class SpringApplicationWebIntegrationTestTests {
@Value("${local.server.port}")
@LocalServerPort
private int port = 0;
@Value("${value}")