25 lines
839 B
Java
25 lines
839 B
Java
package com.dbnt.faisp.config.tomcat;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
|
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
@Configuration
|
|
@RequiredArgsConstructor
|
|
public class TomcatClusterUtil implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> {
|
|
private final TomcatClusterContextCustomizer tomcatClusterContextCustomizer;
|
|
|
|
@Value("${tomcat.cluster.enabled}")
|
|
private boolean clusterEnabled;
|
|
|
|
@Override
|
|
public void customize( final TomcatServletWebServerFactory factory ) {
|
|
if(clusterEnabled){
|
|
factory.addContextCustomizers(tomcatClusterContextCustomizer);
|
|
}
|
|
}
|
|
}
|
|
|