本文整理匯總了Java中org.springframework.boot.autoconfigure.web.ServerProperties.setPort方法的典型用法代碼示例。如果您正苦於以下問題:Java ServerProperties.setPort方法的具體用法?Java ServerProperties.setPort怎麽用?Java ServerProperties.setPort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.boot.autoconfigure.web.ServerProperties
的用法示例。
在下文中一共展示了ServerProperties.setPort方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: serverProperties
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入方法依賴的package包/類
@Bean
public ServerProperties serverProperties() {
ServerProperties properties = new ServerProperties() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
ServerPortConfig.this.count++;
super.customize(container);
}
};
properties.setPort(server.getPort());
properties.setContextPath(server.getContextPath());
return properties;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:EndpointWebMvcAutoConfigurationTests.java
示例2: portFromServerProperties
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入方法依賴的package包/類
@Test
public void portFromServerProperties() {
ServerProperties properties = new ServerProperties();
properties.setPort(1234);
ServerPropertiesEndpointLocator locator = new ServerPropertiesEndpointLocator(
properties, "unknown");
assertThat(locator.local().port).isEqualTo((short) 1234);
}
示例3: portFromServerProperties
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入方法依賴的package包/類
@Test
public void portFromServerProperties() {
ServerProperties properties = new ServerProperties();
properties.setPort(1234);
ServerPropertiesHostLocator locator = new ServerPropertiesHostLocator(properties,
"unknown");
assertThat(locator.locate(this.span).getPort()).isEqualTo((short) 1234);
}
示例4: serverProperties
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入方法依賴的package包/類
@Bean
public ServerProperties serverProperties() {
ServerProperties properties = new ServerProperties() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
ServerPortConfig.this.count++;
super.customize(container);
}
};
properties.setPort(ports.get().server);
return properties;
}
示例5: portFromServerProperties
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入方法依賴的package包/類
@Test
public void portFromServerProperties() throws UnknownHostException {
ServerProperties properties = new ServerProperties();
properties.setPort(1234);
DefaultEndpointLocator locator = new DefaultEndpointLocator(null,
properties, environment, new ZipkinProperties(),localAddress(ADDRESS1234));
assertThat(locator.local().port()).isEqualTo(1234);
}
開發者ID:spring-cloud,項目名稱:spring-cloud-sleuth,代碼行數:11,代碼來源:DefaultEndpointLocatorConfigurationTest.java
示例6: negativePortFromServerProperties
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入方法依賴的package包/類
@Test
public void negativePortFromServerProperties() throws UnknownHostException {
ServerProperties properties = new ServerProperties();
properties.setPort(-1);
DefaultEndpointLocator locator = new DefaultEndpointLocator(null,
properties, environment, new ZipkinProperties(),localAddress(ADDRESS1234));
assertThat(locator.local().port()).isEqualTo(8080);
}
開發者ID:spring-cloud,項目名稱:spring-cloud-sleuth,代碼行數:11,代碼來源:DefaultEndpointLocatorConfigurationTest.java
示例7: portFromServerProperties
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入方法依賴的package包/類
@Test
public void portFromServerProperties() throws UnknownHostException {
ServerProperties properties = new ServerProperties();
properties.setPort(1234);
ServerPropertiesHostLocator locator = new ServerPropertiesHostLocator(properties,
new MockEnvironment(), new ZipkinProperties(),localAddress(ADR1234));
assertThat(locator.locate(this.span).getPort()).isEqualTo((short) 1234);
}
示例8: negativePortFromServerProperties
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入方法依賴的package包/類
@Test
public void negativePortFromServerProperties() throws UnknownHostException {
ServerProperties properties = new ServerProperties();
properties.setPort(-1);
ServerPropertiesHostLocator locator = new ServerPropertiesHostLocator(properties,
new MockEnvironment(), new ZipkinProperties(),localAddress(ADR1234));
assertThat(locator.locate(this.span).getPort()).isEqualTo((short) 8080);
}
示例9: serverProperties
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入方法依賴的package包/類
@Bean
public ServerProperties serverProperties() {
ServerProperties properties = new ServerProperties();
properties.setPort(0);
return properties;
}