org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties Java Examples

The following examples show how to use org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LightminClientProperties.java    From spring-batch-lightmin with Apache License 2.0 6 votes vote down vote up
@Autowired
public LightminClientProperties(final ManagementServerProperties managementServerProperties,
                                final ServerProperties serverProperties,
                                @Value("${spring.batch.lightmin.application-name:null}") final String name,
                                @Value("${endpoints.health.id:health}") final String healthEndpointId,
                                final WebEndpointProperties webEndpointProperties,
                                final Environment environment) {
    if (name == null || "null".equals(name)) {
        this.name = environment.getProperty("spring.application.name", "spring-boot-application");
    } else {
        this.name = name;
    }
    this.healthEndpointId = healthEndpointId;
    this.managementServerProperties = managementServerProperties;
    this.serverProperties = serverProperties;
    this.webEndpointProperties = webEndpointProperties;
}
 
Example #2
Source File: SkipPatternAutoConfiguration.java    From java-spring-web with Apache License 2.0 5 votes vote down vote up
static Optional<Pattern> getPatternForManagementServerProperties(
    ManagementServerProperties managementServerProperties) {
  String contextPath = managementServerProperties.getServlet().getContextPath();
  if (StringUtils.hasText(contextPath)) {
    return Optional.of(Pattern.compile(contextPath + ".*"));
  }
  return Optional.empty();
}
 
Example #3
Source File: SkipPatternConfigTest.java    From java-spring-web with Apache License 2.0 5 votes vote down vote up
@Test
public void testShouldReturnEmptyWhenManagementContextHasNoContextPath() {
  Optional<Pattern> pattern = new SkipPatternAutoConfiguration.ManagementSkipPatternProviderConfig()
      .skipPatternForManagementServerProperties(
          new ManagementServerProperties())
      .pattern();

  then(pattern).isEmpty();
}
 
Example #4
Source File: SkipPatternConfigTest.java    From java-spring-web with Apache License 2.0 5 votes vote down vote up
@Test
public void testShouldReturnManagementContextWithContextPath() {
  ManagementServerProperties properties = new ManagementServerProperties();
  properties.getServlet().setContextPath("foo");

  Optional<Pattern> pattern = new SkipPatternAutoConfiguration.ManagementSkipPatternProviderConfig()
      .skipPatternForManagementServerProperties(properties).pattern();

  then(pattern).isNotEmpty();
  then(pattern.get().pattern()).isEqualTo("foo.*");
}
 
Example #5
Source File: SkipPatternConfiguration.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
/**
 * Sets or appends {@link ManagementServerProperties#getServlet()} to the skip
 * pattern. If neither is available then sets the default one
 * @param managementServerProperties properties
 * @return optional skip pattern
 */
static Optional<Pattern> getPatternForManagementServerProperties(
		ManagementServerProperties managementServerProperties) {
	String contextPath = managementServerProperties.getServlet().getContextPath();
	if (StringUtils.hasText(contextPath)) {
		return Optional.of(Pattern.compile(contextPath + ".*"));
	}
	return Optional.empty();
}
 
Example #6
Source File: SkipPatternConfiguration.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnBean(ManagementServerProperties.class)
public SingleSkipPattern skipPatternForManagementServerProperties(
		final ManagementServerProperties managementServerProperties) {
	return () -> getPatternForManagementServerProperties(
			managementServerProperties);
}
 
Example #7
Source File: SkipPatternProviderConfigTest.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
@Test
public void should_return_empty_when_management_context_has_no_context_path()
		throws Exception {
	Optional<Pattern> pattern = new SkipPatternConfiguration.ManagementSkipPatternProviderConfig()
			.skipPatternForManagementServerProperties(
					new ManagementServerProperties())
			.skipPattern();

	then(pattern).isEmpty();
}
 
Example #8
Source File: ArmeriaSpringActuatorAutoConfiguration.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnProperty("management.server.port")
ArmeriaServerConfigurator secureActuatorServerConfigurator(WebEndpointProperties properties,
                                                           ManagementServerProperties serverProperties,
                                                           ConfigurableEnvironment environment,
                                                           ArmeriaSettings armeriaSettings) {
    return sb -> {
        final Port port = obtainManagementServerPort(serverProperties.getPort());
        if (port != null) {
            configurePorts(sb, ImmutableList.of(port));
            addLocalManagementPortPropertyAlias(environment, port);
            configureSecureDecorator(sb, port, properties.getBasePath(), armeriaSettings);
        }
    };
}
 
Example #9
Source File: ManagementServerPortUtils.java    From spring-cloud-commons with Apache License 2.0 5 votes vote down vote up
public static Integer getPort(BeanFactory beanFactory) {
	if (!hasActuator) {
		return null;
	}
	try {
		ManagementServerProperties properties = beanFactory
				.getBean(ManagementServerProperties.class);
		return properties.getPort();
	}
	catch (NoSuchBeanDefinitionException ex) {
		return null;
	}
}
 
Example #10
Source File: CloudFoundryApplicationFactory.java    From spring-boot-admin with Apache License 2.0 5 votes vote down vote up
public CloudFoundryApplicationFactory(InstanceProperties instance, ManagementServerProperties management,
		ServerProperties server, PathMappedEndpoints pathMappedEndpoints, WebEndpointProperties webEndpoint,
		MetadataContributor metadataContributor, CloudFoundryApplicationProperties cfApplicationProperties) {
	super(instance, management, server, pathMappedEndpoints, webEndpoint, metadataContributor);
	this.cfApplicationProperties = cfApplicationProperties;
	this.instance = instance;
}
 
Example #11
Source File: DefaultApplicationFactory.java    From spring-boot-admin with Apache License 2.0 5 votes vote down vote up
public DefaultApplicationFactory(InstanceProperties instance, ManagementServerProperties management,
		ServerProperties server, PathMappedEndpoints pathMappedEndpoints, WebEndpointProperties webEndpoint,
		MetadataContributor metadataContributor) {
	this.instance = instance;
	this.management = management;
	this.server = server;
	this.pathMappedEndpoints = pathMappedEndpoints;
	this.webEndpoint = webEndpoint;
	this.metadataContributor = metadataContributor;
}
 
Example #12
Source File: ServletApplicationFactory.java    From spring-boot-admin with Apache License 2.0 5 votes vote down vote up
public ServletApplicationFactory(InstanceProperties instance, ManagementServerProperties management,
		ServerProperties server, ServletContext servletContext, PathMappedEndpoints pathMappedEndpoints,
		WebEndpointProperties webEndpoint, MetadataContributor metadataContributor,
		DispatcherServletPath dispatcherServletPath) {
	super(instance, management, server, pathMappedEndpoints, webEndpoint, metadataContributor);
	this.servletContext = servletContext;
	this.server = server;
	this.management = management;
	this.instance = instance;
	this.dispatcherServletPath = dispatcherServletPath;
}
 
Example #13
Source File: SpringBootAdminClientAutoConfiguration.java    From spring-boot-admin with Apache License 2.0 5 votes vote down vote up
@Bean
@Lazy(false)
@ConditionalOnMissingBean
public ApplicationFactory applicationFactory(InstanceProperties instance, ManagementServerProperties management,
		ServerProperties server, ServletContext servletContext, PathMappedEndpoints pathMappedEndpoints,
		WebEndpointProperties webEndpoint, ObjectProvider<List<MetadataContributor>> metadataContributors,
		DispatcherServletPath dispatcherServletPath) {
	return new ServletApplicationFactory(instance, management, server, servletContext, pathMappedEndpoints,
			webEndpoint,
			new CompositeMetadataContributor(metadataContributors.getIfAvailable(Collections::emptyList)),
			dispatcherServletPath);
}
 
Example #14
Source File: SpringBootAdminClientAutoConfiguration.java    From spring-boot-admin with Apache License 2.0 5 votes vote down vote up
@Bean
@Lazy(false)
@ConditionalOnMissingBean
public ApplicationFactory applicationFactory(InstanceProperties instance, ManagementServerProperties management,
		ServerProperties server, PathMappedEndpoints pathMappedEndpoints, WebEndpointProperties webEndpoint,
		ObjectProvider<List<MetadataContributor>> metadataContributors) {
	return new DefaultApplicationFactory(instance, management, server, pathMappedEndpoints, webEndpoint,
			new CompositeMetadataContributor(metadataContributors.getIfAvailable(Collections::emptyList)));
}
 
Example #15
Source File: SpringBootAdminClientCloudFoundryAutoConfiguration.java    From spring-boot-admin with Apache License 2.0 5 votes vote down vote up
@Bean
@Lazy(false)
@ConditionalOnMissingBean
public CloudFoundryApplicationFactory applicationFactory(InstanceProperties instance,
		ManagementServerProperties management, ServerProperties server, PathMappedEndpoints pathMappedEndpoints,
		WebEndpointProperties webEndpoint, ObjectProvider<List<MetadataContributor>> metadataContributors,
		CloudFoundryApplicationProperties cfApplicationProperties) {
	return new CloudFoundryApplicationFactory(instance, management, server, pathMappedEndpoints, webEndpoint,
			new CompositeMetadataContributor(metadataContributors.getIfAvailable(Collections::emptyList)),
			cfApplicationProperties);
}
 
Example #16
Source File: SkipPatternAutoConfiguration.java    From java-spring-web with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnBean(ManagementServerProperties.class)
public SkipPattern skipPatternForManagementServerProperties(
    final ManagementServerProperties managementServerProperties) {
  return () -> getPatternForManagementServerProperties(managementServerProperties);
}