Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 豆子';用户服务.FeignClientSpecification';,在null中定义,无法注册_Spring - Fatal编程技术网

Spring 豆子';用户服务.FeignClientSpecification';,在null中定义,无法注册

Spring 豆子';用户服务.FeignClientSpecification';,在null中定义,无法注册,spring,Spring,我正在启动微服务并抛出以下错误: *************************** APPLICATION FAILED TO START *************************** Description: The bean 'soa-user-service.FeignClientSpecification', defined in null, could not be registered. A bean with that name has already been

我正在启动微服务并抛出以下错误:

***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'soa-user-service.FeignClientSpecification', defined in null, could not be registered. A bean with that name has already been defined in null and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
我知道更改覆盖配置可能会解决此问题。但我想知道有没有其他方法可以避免这个问题。更改覆盖配置只是为了避免问题,可能无法解决安全问题。我需要在一个微服务中定义多个外部客户端,因为我想在多控制器中对我的服务api进行分类,我的控制器如下所示:

@RequestMapping(value="/soa/login")
@FeignClient(name = "soa-user-service")
public interface ILoginController {
}


@RequestMapping(value="/soa/login")
@FeignClient(name = "soa-user-service")
public interface IUserController {
}
如果我将所有api放在一个控制器中,那么这个控制器api太长而且不可读。我的问题是:在一个微服务中有更好的方法避免多控制器冲突吗

附言:

Greenwich.SR1
2.1.4.1发布

是的,有一个解决方案,您可以将属性“contextId”添加到注释@FeignClient,并为每个控制器赋予不同的值

<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
<spring-boot.version>2.1.4.RELEASE</spring-boot.version>