Skip to content

Allow configuring Tomcat properties individually for main application and actuator #23424

@joca-bt

Description

@joca-bt

The current Tomcat configuration properties (server.tomcat.threads.min-spare, server.tomcat.max-connections, etc.) apply to both the main application and the actuator.

Depending on your specific configuration this can lead to some waste, for example, you can end up with many threads in the actuator which are unnecessary (even if idle). Would it make sense to allow configuring them individually via properties? Or is this a use case for programmatic configuration?

I've also tried to configure the connectors programmatically with

@Component
public class TomcatConfiguration implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> {
    @Override
    public void customize(TomcatServletWebServerFactory factory) {
        factory.addConnectorCustomizers(new TomcatConnectorConfiguration());
    }

    public static class TomcatConnectorConfiguration implements TomcatConnectorCustomizer {
        @Override
        public void customize(Connector connector) {
            // do stuff
        }
    }
}

however, TomcatConnectorConfiguration.customize() is not being called for the actuator's connector. Perhaps the actuator is not using another connector?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions