Java 类org.springframework.boot.autoconfigure.web.ServerProperties 实例源码

项目:spring-boot-concourse    文件:ManagementWebSecurityAutoConfiguration.java   
public static RequestMatcher getRequestMatcher(
        ManagementContextResolver contextResolver) {
    if (contextResolver == null) {
        return null;
    }
    ManagementServerProperties management = contextResolver
            .getApplicationContext().getBean(ManagementServerProperties.class);
    ServerProperties server = contextResolver.getApplicationContext()
            .getBean(ServerProperties.class);
    String path = management.getContextPath();
    if (StringUtils.hasText(path)) {
        AntPathRequestMatcher matcher = new AntPathRequestMatcher(
                server.getPath(path) + "/**");
        return matcher;
    }
    // Match everything, including the sensitive and non-sensitive paths
    return new LazyEndpointPathRequestMatcher(contextResolver, EndpointPaths.ALL);
}
项目:spring-boot-starter-purge-accesslog    文件:PurgeAccessLogAutoConfiguration.java   
/**
 * Purge access log customizer embedded servlet container customizer.
 *
 * @param serverProperties the server properties
 * @param purgeProperties  the purge properties
 * @return the embedded servlet container customizer
 */
@Bean
public EmbeddedServletContainerCustomizer purgeAccessLogCustomizer(
        final ServerProperties serverProperties,
        final PurgeProperties purgeProperties) {
    return container -> {
        final UndertowEmbeddedServletContainerFactory factory = (UndertowEmbeddedServletContainerFactory)
                container;
        final Undertow.Accesslog accesslog = serverProperties.getUndertow()
                .getAccesslog();
        final UndertowPurgeAccessLogHolder accessLogHolder = new UndertowPurgeAccessLogHolder(
                purgeProperties, accesslog.getDir().toPath(),
                accesslog.getPrefix(), accesslog.getSuffix());
        factory.addDeploymentInfoCustomizers(accessLogHolder);
    };
}
项目:spring-boot-starter-purge-accesslog    文件:PurgeAccessLogAutoConfiguration.java   
/**
 * Purge access log customizer embedded servlet container customizer.
 *
 * @param serverProperties the server properties
 * @param purgeProperties  the purge properties
 * @return the embedded servlet container customizer
 */
@Bean
public EmbeddedServletContainerCustomizer purgeAccessLogCustomizer(
        final ServerProperties serverProperties,
        final PurgeProperties purgeProperties) {
    return container -> {
        final TomcatEmbeddedServletContainerFactory factory = (TomcatEmbeddedServletContainerFactory) container;
        final Accesslog accesslog = serverProperties.getTomcat().getAccesslog();
        factory.getEngineValves().stream()
                .filter(valve -> valve instanceof AccessLogValve)
                .map(valve -> (AccessLogValve) valve).findFirst()
                .ifPresent(valve -> {
                    final TomcatPurgeAccessLogHolder accessLogHolder = new TomcatPurgeAccessLogHolder(
                            purgeProperties, Paths.get(accesslog.getDirectory()),
                            accesslog.getPrefix(), accesslog.getSuffix(), valve);
                    factory.addContextCustomizers(accessLogHolder);
                });
    };
}
项目:Robocode    文件:AppConfig.java   
@Bean
@Autowired
public EmbeddedServletContainerCustomizer servletContainerCustomizer(ServerProperties properties) {
    return container -> {
        if (container instanceof JettyEmbeddedServletContainerFactory) {
            JettyEmbeddedServletContainerFactory jettyContainer = (JettyEmbeddedServletContainerFactory) container;
            jettyContainer.addConfigurations(new AbstractConfiguration() {

                @Override
                public void configure(WebAppContext context) throws Exception {
                    properties.getContextParameters().forEach((k, v) -> context.setInitParameter(k, v));
                }
            });
        }
    };
}
项目:charon-spring-boot-starter    文件:RequestForwarder.java   
public RequestForwarder(
        ServerProperties server,
        CharonProperties charon,
        HttpClientProvider httpClientProvider,
        MappingsProvider mappingsProvider,
        LoadBalancer loadBalancer,
        MetricRegistry metricRegistry,
        TraceInterceptor traceInterceptor
) {
    this.server = server;
    this.charon = charon;
    this.httpClientProvider = httpClientProvider;
    this.mappingsProvider = mappingsProvider;
    this.loadBalancer = loadBalancer;
    this.metricRegistry = metricRegistry;
    this.traceInterceptor = traceInterceptor;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ManagementWebSecurityAutoConfiguration.java   
public static RequestMatcher getRequestMatcher(
        ManagementContextResolver contextResolver) {
    if (contextResolver == null) {
        return null;
    }
    ManagementServerProperties management = contextResolver
            .getApplicationContext().getBean(ManagementServerProperties.class);
    ServerProperties server = contextResolver.getApplicationContext()
            .getBean(ServerProperties.class);
    String path = management.getContextPath();
    if (StringUtils.hasText(path)) {
        AntPathRequestMatcher matcher = new AntPathRequestMatcher(
                server.getPath(path) + "/**");
        return matcher;
    }
    // Match everything, including the sensitive and non-sensitive paths
    return new LazyEndpointPathRequestMatcher(contextResolver, EndpointPaths.ALL);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointWebMvcChildContextConfiguration.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    if (this.managementServerProperties == null) {
        this.managementServerProperties = BeanFactoryUtils
                .beanOfTypeIncludingAncestors(this.beanFactory,
                        ManagementServerProperties.class);
        this.server = BeanFactoryUtils.beanOfTypeIncludingAncestors(
                this.beanFactory, ServerProperties.class);
    }
    // Customize as per the parent context first (so e.g. the access logs go to
    // the same place)
    this.server.customize(container);
    // Then reset the error pages
    container.setErrorPages(Collections.<ErrorPage>emptySet());
    // and the context path
    container.setContextPath("");
    // and add the management-specific bits
    container.setPort(this.managementServerProperties.getPort());
    if (this.managementServerProperties.getSsl() != null) {
        container.setSsl(this.managementServerProperties.getSsl());
    }
    container.setServerHeader(this.server.getServerHeader());
    container.setAddress(this.managementServerProperties.getAddress());
    container.addErrorPages(new ErrorPage(this.server.getError().getPath()));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointWebMvcAutoConfiguration.java   
public static ManagementServerPort get(Environment environment,
        BeanFactory beanFactory) {
    Integer serverPort = getPortProperty(environment, "server.");
    if (serverPort == null && hasCustomBeanDefinition(beanFactory,
            ServerProperties.class, ServerPropertiesAutoConfiguration.class)) {
        serverPort = getTemporaryBean(beanFactory, ServerProperties.class)
                .getPort();
    }
    Integer managementPort = getPortProperty(environment, "management.");
    if (managementPort == null && hasCustomBeanDefinition(beanFactory,
            ManagementServerProperties.class,
            ManagementServerPropertiesAutoConfiguration.class)) {
        managementPort = getTemporaryBean(beanFactory,
                ManagementServerProperties.class).getPort();
    }
    if (managementPort != null && managementPort < 0) {
        return DISABLE;
    }
    return ((managementPort == null)
            || (serverPort == null && managementPort.equals(8080))
            || (managementPort != 0 && managementPort.equals(serverPort)) ? SAME
                    : DIFFERENT);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointWebMvcAutoConfigurationTests.java   
@Test
public void overrideServerProperties() throws Exception {
    EnvironmentTestUtils.addEnvironment(this.applicationContext,
            "server.displayName:foo");
    this.applicationContext.register(RootConfig.class, EndpointConfig.class,
            ServerPortConfig.class, PropertyPlaceholderAutoConfiguration.class,
            ManagementServerPropertiesAutoConfiguration.class,
            ServerPropertiesAutoConfiguration.class, JacksonAutoConfiguration.class,
            EmbeddedServletContainerAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class,
            DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
            EndpointWebMvcAutoConfiguration.class);
    this.applicationContext.refresh();
    assertContent("/controller", ports.get().server, "controlleroutput");
    ServerProperties serverProperties = this.applicationContext
            .getBean(ServerProperties.class);
    assertThat(serverProperties.getDisplayName()).isEqualTo("foo");
}
项目:spring-boot-concourse    文件:EndpointWebMvcChildContextConfiguration.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    if (this.managementServerProperties == null) {
        this.managementServerProperties = BeanFactoryUtils
                .beanOfTypeIncludingAncestors(this.beanFactory,
                        ManagementServerProperties.class);
        this.server = BeanFactoryUtils.beanOfTypeIncludingAncestors(
                this.beanFactory, ServerProperties.class);
    }
    // Customize as per the parent context first (so e.g. the access logs go to
    // the same place)
    this.server.customize(container);
    // Then reset the error pages
    container.setErrorPages(Collections.<ErrorPage>emptySet());
    // and the context path
    container.setContextPath("");
    // and add the management-specific bits
    container.setPort(this.managementServerProperties.getPort());
    container.setServerHeader(this.server.getServerHeader());
    container.setAddress(this.managementServerProperties.getAddress());
    container.addErrorPages(new ErrorPage(this.server.getError().getPath()));
}
项目:spring-boot-concourse    文件:EndpointWebMvcAutoConfiguration.java   
public static ManagementServerPort get(Environment environment,
        BeanFactory beanFactory) {
    Integer serverPort = getPortProperty(environment, "server.");
    if (serverPort == null && hasCustomBeanDefinition(beanFactory,
            ServerProperties.class, ServerPropertiesAutoConfiguration.class)) {
        serverPort = getTemporaryBean(beanFactory, ServerProperties.class)
                .getPort();
    }
    Integer managementPort = getPortProperty(environment, "management.");
    if (managementPort == null && hasCustomBeanDefinition(beanFactory,
            ManagementServerProperties.class,
            ManagementServerPropertiesAutoConfiguration.class)) {
        managementPort = getTemporaryBean(beanFactory,
                ManagementServerProperties.class).getPort();
    }
    if (managementPort != null && managementPort < 0) {
        return DISABLE;
    }
    return ((managementPort == null)
            || (serverPort == null && managementPort.equals(8080))
            || (managementPort != 0 && managementPort.equals(serverPort)) ? SAME
                    : DIFFERENT);
}
项目:spring-boot-concourse    文件:EndpointWebMvcAutoConfigurationTests.java   
@Test
public void overrideServerProperties() throws Exception {
    EnvironmentTestUtils.addEnvironment(this.applicationContext,
            "server.displayName:foo");
    this.applicationContext.register(RootConfig.class, EndpointConfig.class,
            ServerPortConfig.class, PropertyPlaceholderAutoConfiguration.class,
            ManagementServerPropertiesAutoConfiguration.class,
            ServerPropertiesAutoConfiguration.class, JacksonAutoConfiguration.class,
            EmbeddedServletContainerAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class,
            DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
            EndpointWebMvcAutoConfiguration.class);
    this.applicationContext.refresh();
    assertContent("/controller", ports.get().server, "controlleroutput");
    ServerProperties serverProperties = this.applicationContext
            .getBean(ServerProperties.class);
    assertThat(serverProperties.getDisplayName()).isEqualTo("foo");
}
项目:contestparser    文件:EndpointWebMvcChildContextConfiguration.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    if (this.managementServerProperties == null) {
        this.managementServerProperties = BeanFactoryUtils
                .beanOfTypeIncludingAncestors(this.beanFactory,
                        ManagementServerProperties.class);
        this.server = BeanFactoryUtils.beanOfTypeIncludingAncestors(
                this.beanFactory, ServerProperties.class);
    }
    // Customize as per the parent context first (so e.g. the access logs go to
    // the same place)
    this.server.customize(container);
    // Then reset the error pages
    container.setErrorPages(Collections.<ErrorPage>emptySet());
    // and add the management-specific bits
    container.setPort(this.managementServerProperties.getPort());
    container.setAddress(this.managementServerProperties.getAddress());
    container.addErrorPages(new ErrorPage(this.server.getError().getPath()));
}
项目:errorest-spring-boot-starter    文件:ServletFilterErrorHandler.java   
public ServletFilterErrorHandler(ErrorAttributes errorAttributes, ServerProperties serverProperties, ErrorsFactory errorsFactory, ErrorDataProviderContext providerContext) {
    super(errorAttributes, emptyList());
    this.errorAttributes = errorAttributes;
    errorProperties = serverProperties.getError();
    this.errorsFactory = errorsFactory;
    this.providerContext = providerContext;
}
项目:wingtips    文件:SampleController.java   
@Autowired
public SampleController(ServerProperties serverProps, Environment environment) {
    this.serverPort = serverProps.getPort();
    String userIdHeaderKeysFromEnv = environment.getProperty("wingtips.user-id-header-keys");
    this.userIdHeaderKeys = (userIdHeaderKeysFromEnv == null)
                            ? null
                            : Arrays.asList(userIdHeaderKeysFromEnv.split(","));
}
项目:charon-spring-boot-starter    文件:MappingsProvider.java   
public MappingsProvider(
        ServerProperties server,
        CharonProperties charon,
        MappingsCorrector mappingsCorrector,
        HttpClientProvider httpClientProvider
) {
    this.server = server;
    this.charon = charon;
    this.mappingsCorrector = mappingsCorrector;
    this.httpClientProvider = httpClientProvider;
}
项目:charon-spring-boot-starter    文件:ConfigurationMappingsProvider.java   
public ConfigurationMappingsProvider(
        ServerProperties server,
        CharonProperties charon,
        MappingsCorrector mappingsCorrector,
        HttpClientProvider httpClientProvider
) {
    super(server, charon, mappingsCorrector, httpClientProvider);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ManagementWebSecurityAutoConfiguration.java   
private RequestMatcher createDelegate() {
    ServerProperties server = this.contextResolver.getApplicationContext()
            .getBean(ServerProperties.class);
    List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
    EndpointHandlerMapping endpointHandlerMapping = getRequiredEndpointHandlerMapping();
    for (String path : this.endpointPaths.getPaths(endpointHandlerMapping)) {
        matchers.add(new AntPathRequestMatcher(server.getPath(path)));
    }
    return (matchers.isEmpty() ? MATCH_NONE : new OrRequestMatcher(matchers));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointWebMvcHypermediaManagementContextConfiguration.java   
@Bean
@ConditionalOnBean(DocsMvcEndpoint.class)
@ConditionalOnMissingBean(CurieProvider.class)
@ConditionalOnProperty(prefix = "endpoints.docs.curies", name = "enabled", matchIfMissing = false)
public DefaultCurieProvider curieProvider(ServerProperties server,
        ManagementServerProperties management, DocsMvcEndpoint endpoint) {
    String path = management.getContextPath() + endpoint.getPath()
            + "/#spring_boot_actuator__{rel}";
    if (server.getPort().equals(management.getPort()) && management.getPort() != 0) {
        path = server.getPath(path);
    }
    return new DefaultCurieProvider("boot", new UriTemplate(path));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointWebMvcAutoConfigurationTests.java   
@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;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SamplePropertyValidationApplicationTests.java   
@Test
public void validatorOnlyCalledOnSupportedClass() {
    this.context.register(SamplePropertyValidationApplication.class);
    this.context.register(ServerProperties.class); // our validator will not apply
    EnvironmentTestUtils.addEnvironment(this.context, "sample.host:192.168.0.1",
            "sample.port:9090");
    this.context.refresh();
    SampleProperties properties = this.context.getBean(SampleProperties.class);
    assertThat(properties.getHost()).isEqualTo("192.168.0.1");
    assertThat(properties.getPort()).isEqualTo(Integer.valueOf(9090));
}
项目:spring-boot-keycloak-server-example    文件:EmbeddedKeycloakApp.java   
@Bean
ApplicationListener<ApplicationReadyEvent> onApplicationReadyEventListener(ServerProperties serverProperties, KeycloakServerProperties keycloakServerProperties) {

  return (evt) -> {

    Integer port = serverProperties.getPort();
    String rootContextPath = serverProperties.getContextPath();
    String keycloakContextPath = keycloakServerProperties.getContextPath();

    System.out.printf("Embedded Keycloak started: http://localhost:%s%s%s to use keycloak%n", port, rootContextPath, keycloakContextPath);
  };
}
项目:Zipkin    文件:ServerPropertiesEndpointLocatorTests.java   
@Test
public void portDefaultsTo8080() {
    ServerPropertiesEndpointLocator locator = new ServerPropertiesEndpointLocator(
            new ServerProperties(), "unknown");

    assertThat(locator.local().port).isEqualTo((short) 8080);
}
项目:Zipkin    文件:ServerPropertiesEndpointLocatorTests.java   
@Test
public void portFromServerProperties() {
    ServerProperties properties = new ServerProperties();
    properties.setPort(1234);

    ServerPropertiesEndpointLocator locator = new ServerPropertiesEndpointLocator(
            properties, "unknown");

    assertThat(locator.local().port).isEqualTo((short) 1234);
}
项目:Zipkin    文件:ServerPropertiesEndpointLocatorTests.java   
@Test
public void portDefaultsToLocalhost() {
    ServerPropertiesEndpointLocator locator = new ServerPropertiesEndpointLocator(
            new ServerProperties(), "unknown");

    assertThat(locator.local().ipv4).isEqualTo(127 << 24 | 1);
}
项目:Zipkin    文件:ServerPropertiesEndpointLocatorTests.java   
@Test
public void hostFromServerPropertiesIp() throws UnknownHostException {
    ServerProperties properties = new ServerProperties();
    properties.setAddress(InetAddress.getByAddress(new byte[] { 1, 2, 3, 4 }));

    ServerPropertiesEndpointLocator locator = new ServerPropertiesEndpointLocator(
            properties, "unknown");

    assertThat(locator.local().ipv4).isEqualTo(1 << 24 | 2 << 16 | 3 << 8 | 4);
}
项目:Zipkin    文件:ServerPropertiesHostLocatorTests.java   
@Test
public void portDefaultsTo8080() {
    ServerPropertiesHostLocator locator = new ServerPropertiesHostLocator(
            new ServerProperties(), "unknown");

    assertThat(locator.locate(this.span).getPort()).isEqualTo((short) 8080);
}
项目:Zipkin    文件:ServerPropertiesHostLocatorTests.java   
@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);
}
项目:Zipkin    文件:ServerPropertiesHostLocatorTests.java   
@Test
public void portDefaultsToLocalhost() {
    ServerPropertiesHostLocator locator = new ServerPropertiesHostLocator(
            new ServerProperties(), "unknown");

    assertThat(locator.locate(this.span).getAddress()).isEqualTo("127.0.0.1");
}
项目:Zipkin    文件:ServerPropertiesHostLocatorTests.java   
@Test
public void hostFromServerPropertiesIp() throws UnknownHostException {
    ServerProperties properties = new ServerProperties();
    properties.setAddress(InetAddress.getByAddress(new byte[] { 1, 2, 3, 4 }));

    ServerPropertiesHostLocator locator = new ServerPropertiesHostLocator(properties,
            "unknown");

    assertThat(locator.locate(this.span).getAddress()).isEqualTo("1.2.3.4");
}
项目:spring-boot-concourse    文件:ManagementWebSecurityAutoConfiguration.java   
private RequestMatcher createDelegate() {
    ServerProperties server = this.contextResolver.getApplicationContext()
            .getBean(ServerProperties.class);
    List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
    EndpointHandlerMapping endpointHandlerMapping = getRequiredEndpointHandlerMapping();
    for (String path : this.endpointPaths.getPaths(endpointHandlerMapping)) {
        matchers.add(new AntPathRequestMatcher(server.getPath(path)));
    }
    return (matchers.isEmpty() ? MATCH_NONE : new OrRequestMatcher(matchers));
}
项目:spring-boot-concourse    文件:EndpointWebMvcHypermediaManagementContextConfiguration.java   
@Bean
@ConditionalOnBean(DocsMvcEndpoint.class)
@ConditionalOnMissingBean(CurieProvider.class)
@ConditionalOnProperty(prefix = "endpoints.docs.curies", name = "enabled", matchIfMissing = false)
public DefaultCurieProvider curieProvider(ServerProperties server,
        ManagementServerProperties management, DocsMvcEndpoint endpoint) {
    String path = management.getContextPath() + endpoint.getPath()
            + "/#spring_boot_actuator__{rel}";
    if (server.getPort().equals(management.getPort()) && management.getPort() != 0) {
        path = server.getPath(path);
    }
    return new DefaultCurieProvider("boot", new UriTemplate(path));
}
项目:spring-boot-concourse    文件:EndpointWebMvcAutoConfigurationTests.java   
@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;
}
项目:spring-boot-concourse    文件:SamplePropertyValidationApplicationTests.java   
@Test
public void validatorOnlyCalledOnSupportedClass() {
    this.context.register(SamplePropertyValidationApplication.class);
    this.context.register(ServerProperties.class); // our validator will not apply
    EnvironmentTestUtils.addEnvironment(this.context, "sample.host:192.168.0.1",
            "sample.port:9090");
    this.context.refresh();
    SampleProperties properties = this.context.getBean(SampleProperties.class);
    assertThat(properties.getHost()).isEqualTo("192.168.0.1");
    assertThat(properties.getPort()).isEqualTo(Integer.valueOf(9090));
}
项目:contestparser    文件:ManagementWebSecurityAutoConfiguration.java   
private RequestMatcher createDelegate() {
    ServerProperties server = ManagementWebSecurityConfigurerAdapter.this.server;
    List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
    EndpointHandlerMapping endpointHandlerMapping = ManagementWebSecurityConfigurerAdapter.this
            .getRequiredEndpointHandlerMapping();
    for (String path : this.endpointPaths.getPaths(endpointHandlerMapping)) {
        matchers.add(new AntPathRequestMatcher(server.getPath(path)));
    }
    return (matchers.isEmpty() ? AnyRequestMatcher.INSTANCE
            : new OrRequestMatcher(matchers));
}
项目:contestparser    文件:EndpointWebMvcChildContextConfiguration.java   
@Bean
@ConditionalOnBean(ErrorAttributes.class)
public ManagementErrorEndpoint errorEndpoint(ServerProperties serverProperties,
        ErrorAttributes errorAttributes) {
    return new ManagementErrorEndpoint(serverProperties.getError().getPath(),
            errorAttributes);
}
项目:contestparser    文件:EndpointWebMvcHypermediaManagementContextConfiguration.java   
@Bean
@ConditionalOnBean(ActuatorDocsEndpoint.class)
@ConditionalOnMissingBean(CurieProvider.class)
@ConditionalOnProperty(prefix = "endpoints.docs.curies", name = "enabled", matchIfMissing = false)
public DefaultCurieProvider curieProvider(ServerProperties server,
        ManagementServerProperties management, ActuatorDocsEndpoint endpoint) {
    String path = management.getContextPath() + endpoint.getPath()
            + "/#spring_boot_actuator__{rel}";
    if (server.getPort() == management.getPort() && management.getPort() != null
            && management.getPort() != 0) {
        path = server.getPath(path);
    }
    return new DefaultCurieProvider("boot", new UriTemplate(path));
}
项目:contestparser    文件:EndpointWebMvcAutoConfigurationTests.java   
@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;
}
项目:contestparser    文件:SessionAutoConfigurationTests.java   
@Test
public void flat() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    this.context.register(Config.class, ServerPropertiesAutoConfiguration.class,
            RedisAutoConfiguration.class, SessionAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    ServerProperties server = this.context.getBean(ServerProperties.class);
    assertNotNull(server);
}
项目:contestparser    文件:SessionAutoConfigurationTests.java   
@Test
public void hierarchy() throws Exception {
    AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext();
    parent.register(RedisAutoConfiguration.class, SessionAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    parent.refresh();
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    this.context.setParent(parent);
    this.context.register(Config.class, ServerPropertiesAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    ServerProperties server = this.context.getBean(ServerProperties.class);
    assertNotNull(server);
}