Facing issue with Microservice using netflix zuul in SpringBoot
Asked Answered
W

2

11

APPLICATION FAILED TO START


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

Witchy answered 21/8, 2018 at 16:33 Comment(2)
Please share your pom.xml if you use MavenLubricious
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-zuul</artifactId> </dependency>Witchy
A
15

Use the Spring Boot version of 2.0.x...they haven't introduced the Zuul support for 2.1.x

Thanks

Arri answered 22/8, 2018 at 1:42 Comment(2)
But Is there any way to support for 2.1.x. also?Witchy
No. It is not supported by Spring 2.1 version. Probably in future. Till then you can work with 2.0.X version also, it has same features...Arri
R
-2

This will solve by adding below config in yml or properties file.

    spring:
      main:
        allow-bean-definition-overriding: true
Reorientation answered 11/3, 2019 at 21:36 Comment(1)
However, be cautious when enabling bean definition overriding, as it may cause unexpected behavior if multiple beans with the same name are defined and overridden without proper understanding of their intended usage and dependencies. It's recommended to choose the appropriate option based on your application's requirements and design. Renaming the beans to have unique names is usually a safer approach to avoid conflicts and ensure proper separation of concerns.Mera

© 2022 - 2024 — McMap. All rights reserved.