Skip to content

Management endpoints are created even though they are disabled #2921

Closed
@aheusingfeld

Description

@aheusingfeld

Though Spring Boot provides the configuration property to disable certain management endpoints, all of them are instantiated no matter whether they are enabled or disabled via configuration. Especially looking at the TraceEndpoint which holds an instance of TraceRepository which again references objects representing the last 100 HTTP requests, we seem to be looking at memory hogs here.

A very naive idea to avoid this would be something like this (from org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration)

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnExpression("${endpoints.trace.enabled}")
    public TraceEndpoint traceEndpoint(@Value("${trace.repository.capacity}") int capacity) {
        this.traceRepository.setCapacity(capacity);
        return new TraceEndpoint(this.traceRepository);
    }

but I'm not sure about the side effects this might introduce. And this doesn't prevent the TraceRepository and the WebRequestTraceFilter from being instantiated.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions