I'm migrating my project Spring to Spring Boot. But I'm faced with a problem, we have a reverse proxy using apache2 and mod_cluster. In actual version we declare a Listerner in the server.xml.
<Listener className="org.jboss.modcluster.container.catalina.standalone.ModClusterListener" advertise="false" proxyList="${proxyList}" />
I put it like a Spring boot application.
private Connector ajpConnector() {
Connector connector = new Connector("AJP/1.3");
connector.setPort(8009);
connector.setRedirectPort(8443);
return connector;
}
private ModClusterListener modCluster() {
ModClusterListener modClusterListener = new ModClusterListener();
modClusterListener.setAdvertise(false);
modClusterListener.setProxyURL(proxyUrl);
return modClusterListener;
}
@Bean
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> servletContainer() {
return server -> {
if (server != null) {
server.addContextLifecycleListeners(modCluster());
server.addAdditionalTomcatConnectors(ajpConnector());
}
};
}
But it don't work, the ModClusterListener want a LifecycleEvent of type Sever, but it never happen. Can anyone help me?