Add @LocalServerPort
Closes gh-5262
This commit is contained in:
committed by
Stephane Nicoll
parent
a3a38c6bbc
commit
f6a32a1d5a
@@ -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}")
|
||||
|
||||
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user