paginationInterceptor bean冲突的问题

Blade 未结 1 2352
jackson0415
jackson0415 2019-07-25 18:16

在boot版本部署到tomcat上后,启动发现存在bean冲突的问题;

TenantConfiguration和MybatisPlusConfiguration中注入的bean出现冲突,导致环境启动失败。


Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'paginationInterceptor' defined in class path resource [org/springblade/core/boot/tenant/TenantConfiguration.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springblade.core.boot.tenant.TenantConfiguration; factoryMethodName=paginationInterceptor; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springblade/core/boot/tenant/TenantConfiguration.class]] for bean 'paginationInterceptor': There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springblade.core.boot.config.MybatisPlusConfiguration; factoryMethodName=paginationInterceptor; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springblade/core/boot/config/MybatisPlusConfiguration.class]] bound.

1条回答
  •  admin
    admin (楼主)
    2019-07-30 11:21

    MybatisPlusConfiguration做了bean加载的校验。如果已经存在,则不会生成

    image.png


    而TenantConfiguration是配置在之前加载的,理论上不会出问题
    image.png

    0 讨论(1)
提交回复