Skip to content

Instantly share code, notes, and snippets.

@SimoneGianni
Created December 19, 2019 23:41
Show Gist options
  • Save SimoneGianni/74b3b7e5f5986a72a95e705cc6abe6dc to your computer and use it in GitHub Desktop.
Save SimoneGianni/74b3b7e5f5986a72a95e705cc6abe6dc to your computer and use it in GitHub Desktop.
import org.apache.catalina.Context;
import org.springframework.boot.web.embedded.tomcat.TomcatContextCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
public class TurnOffEmbeddedTomcatReload {
@Bean
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> servletContainerCustomizer() {
return new WebServerFactoryCustomizer<TomcatServletWebServerFactory>() {
@Override
public void customize(TomcatServletWebServerFactory container) {
container.addContextCustomizers(new TomcatContextCustomizer() {
@Override
public void customize(Context cntxt) {
cntxt.setReloadable(false);
}
});
}
};
}
}
@DIOGOODELLI
Copy link

this save my life.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment