The bean 'counterFactory', could not be registered

问题:

在springboot下配置好zuul的依赖后,启动报错:

Description:

The bean 'counterFactory', defined in class path resource [org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration$ZuulCounterFactoryConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration$ZuulMetricsConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true


Process finished with exit code 1

原因:

springboot和zuul的版本不兼容,springboot版本太高了,zuul的版本相对低很多

	<parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.1.1.RELEASEversion>
        <relativePath/> 
    parent>

        <dependency>
            <groupId>org.springframework.cloudgroupId>
            <artifactId>spring-cloud-starter-netflix-zuulartifactId>
            <version>2.0.2.RELEASEversion>
        dependency>

解决方案:

更换springboot版本为2.0.5或2.0.6,可以正常运行。

原来微信打赏还可以备注哦

在这里插入图片描述

你可能感兴趣的:(异常,zuul启动报错)