Search in sources :

Example 1 with ReadOperation

use of org.springframework.boot.actuate.endpoint.annotation.ReadOperation in project spring-cloud-netflix by spring-cloud.

the class ArchaiusEndpoint method invoke.

@ReadOperation
public Map<String, Object> invoke() {
    Map<String, Object> map = new LinkedHashMap<>();
    AbstractConfiguration config = ConfigurationManager.getConfigInstance();
    if (config instanceof ConcurrentCompositeConfiguration) {
        ConcurrentCompositeConfiguration composite = (ConcurrentCompositeConfiguration) config;
        for (Configuration item : composite.getConfigurations()) {
            append(map, item);
        }
    } else {
        append(map, config);
    }
    return map;
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) Configuration(org.apache.commons.configuration.Configuration) ConcurrentCompositeConfiguration(com.netflix.config.ConcurrentCompositeConfiguration) AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) SystemConfiguration(org.apache.commons.configuration.SystemConfiguration) EnvironmentConfiguration(org.apache.commons.configuration.EnvironmentConfiguration) ConcurrentCompositeConfiguration(com.netflix.config.ConcurrentCompositeConfiguration) LinkedHashMap(java.util.LinkedHashMap) ReadOperation(org.springframework.boot.actuate.endpoint.annotation.ReadOperation)

Example 2 with ReadOperation

use of org.springframework.boot.actuate.endpoint.annotation.ReadOperation in project spring-boot by spring-projects.

the class FlywayEndpoint method flywayBeans.

@ReadOperation
public ApplicationFlywayBeans flywayBeans() {
    ApplicationContext target = this.context;
    Map<String, ContextFlywayBeans> contextFlywayBeans = new HashMap<>();
    while (target != null) {
        Map<String, FlywayDescriptor> flywayBeans = new HashMap<>();
        target.getBeansOfType(Flyway.class).forEach((name, flyway) -> flywayBeans.put(name, new FlywayDescriptor(flyway.info().all())));
        ApplicationContext parent = target.getParent();
        contextFlywayBeans.put(target.getId(), new ContextFlywayBeans(flywayBeans, (parent != null) ? parent.getId() : null));
        target = parent;
    }
    return new ApplicationFlywayBeans(contextFlywayBeans);
}
Also used : Flyway(org.flywaydb.core.Flyway) ApplicationContext(org.springframework.context.ApplicationContext) HashMap(java.util.HashMap) ReadOperation(org.springframework.boot.actuate.endpoint.annotation.ReadOperation)

Example 3 with ReadOperation

use of org.springframework.boot.actuate.endpoint.annotation.ReadOperation in project spring-boot by spring-projects.

the class LoggersEndpoint method loggerLevels.

@ReadOperation
public LoggerLevels loggerLevels(@Selector String name) {
    Assert.notNull(name, "Name must not be null");
    LoggerGroup group = this.loggerGroups.get(name);
    if (group != null) {
        return new GroupLoggerLevels(group.getConfiguredLevel(), group.getMembers());
    }
    LoggerConfiguration configuration = this.loggingSystem.getLoggerConfiguration(name);
    return (configuration != null) ? new SingleLoggerLevels(configuration) : null;
}
Also used : LoggerConfiguration(org.springframework.boot.logging.LoggerConfiguration) LoggerGroup(org.springframework.boot.logging.LoggerGroup) ReadOperation(org.springframework.boot.actuate.endpoint.annotation.ReadOperation)

Example 4 with ReadOperation

use of org.springframework.boot.actuate.endpoint.annotation.ReadOperation in project spring-boot by spring-projects.

the class ConfigurationPropertiesReportEndpointWebExtension method configurationPropertiesWithPrefix.

@ReadOperation
public WebEndpointResponse<ApplicationConfigurationProperties> configurationPropertiesWithPrefix(@Selector String prefix) {
    ApplicationConfigurationProperties configurationProperties = this.delegate.configurationPropertiesWithPrefix(prefix);
    boolean foundMatchingBeans = configurationProperties.getContexts().values().stream().anyMatch((context) -> !context.getBeans().isEmpty());
    return (foundMatchingBeans) ? new WebEndpointResponse<>(configurationProperties, WebEndpointResponse.STATUS_OK) : new WebEndpointResponse<>(WebEndpointResponse.STATUS_NOT_FOUND);
}
Also used : ApplicationConfigurationProperties(org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ApplicationConfigurationProperties) ReadOperation(org.springframework.boot.actuate.endpoint.annotation.ReadOperation)

Example 5 with ReadOperation

use of org.springframework.boot.actuate.endpoint.annotation.ReadOperation in project spring-boot by spring-projects.

the class MappingsEndpoint method mappings.

@ReadOperation
public ApplicationMappings mappings() {
    ApplicationContext target = this.context;
    Map<String, ContextMappings> contextMappings = new HashMap<>();
    while (target != null) {
        contextMappings.put(target.getId(), mappingsForContext(target));
        target = target.getParent();
    }
    return new ApplicationMappings(contextMappings);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) HashMap(java.util.HashMap) ReadOperation(org.springframework.boot.actuate.endpoint.annotation.ReadOperation)

Aggregations

ReadOperation (org.springframework.boot.actuate.endpoint.annotation.ReadOperation)27 Operation (io.swagger.v3.oas.annotations.Operation)14 lombok.val (lombok.val)14 HashMap (java.util.HashMap)10 LinkedHashMap (java.util.LinkedHashMap)10 Map (java.util.Map)9 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)9 BaseCasActuatorEndpoint (org.apereo.cas.web.BaseCasActuatorEndpoint)9 Endpoint (org.springframework.boot.actuate.endpoint.annotation.Endpoint)9 Parameter (io.swagger.v3.oas.annotations.Parameter)8 StringUtils (org.apache.commons.lang3.StringUtils)8 Nullable (org.springframework.lang.Nullable)6 ApplicationContext (org.springframework.context.ApplicationContext)5 Collectors (java.util.stream.Collectors)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Objects (java.util.Objects)3 StreamSupport (java.util.stream.StreamSupport)3 Slf4j (lombok.extern.slf4j.Slf4j)3 CollectionUtils (org.apereo.cas.util.CollectionUtils)3