Additional connectors can be created to add additional ports to the TomcatServletWebServerFactory by creating a WebServerFactorCustomizer bean and calling the addAdditionalTomcatConnectors() method, but connectors added this way do not have customization applied from application.properties as one might expect. This is the documented way of adding additional connectors as of 3.1.x doc.
This customization can be manually applied by calling getTomcatConnectorCustomizers(), then calling customize(connector) with each value from the collection returned. This seems to be a workaround instead of creating multiple TomcatWebServers. This could be problematic if there are multiple WebServerFactoryCustomizer beans within a project that call addContextCustomizer() resulting in inconsistent customization being applied to connectors added in different beans.
It should be clearer that connectors created in this way will not have this customization applied.
Related: #17144
Comment From: wilkinsona
Thanks for the suggestion but I don't think it makes sense to apply the same customization to every connector automatically. It would be a breaking change and it would also make it harder to have multiple connectors with different configuration. We can update the javadoc of addAdditionalTomcatConnectors() to make it clear that the factory will not apply its connection customizers to the additional connectors.