报错

最近公司重构项目- -  某个需求需要使用MongoDB..搭建环境的时候  出现这个问题.... 看了其他博客说要降低SpringBoot内置的Tomcat版本- - 但是试了几次都没啥用  还是会报这个错误.. 最后在SpringBoot的的Issues中找到了答案..

贴出issue地址

https://github.com/spring-projects/spring-boot/issues/19308

@Bean
public static BeanFactoryPostProcessor removeTomcatWebServerCustomizer() {
    return (beanFactory) -> 
        ((DefaultListableBeanFactory)beanFactory).removeBeanDefinition("tomcatWebServerFactoryCustomizer");
}
原文地址:https://www.cnblogs.com/chenyiwu/p/14413715.html