-
Notifications
You must be signed in to change notification settings - Fork 813
Description
Describe the bug
- open feign version
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign:4.1.1'
- It is assumed that the package structure is the same across modules.
Hi, I have discovered issue.
In a multi-module Spring Boot project, when @EnableFeignClients is configured in the main application class, it does not detect Feign clients implementing other modules.
implementation project(':common-lib')
In a situation where a module references a library module like common-lib using implementation project(':common-lib'), the beans are not being detected.(Assuming the module package structure is the same)
However, when explicitly setting the package path in @EnableFeignClients(ex: @EnableFeignClients("org.project")), it successfully scans and registers Feign client beans from other modules.
I'm curious whether this is the intended behavior or if it might be an issue.
If this behavior is not intentional, it would be helpful to document it in the related documentation. (Should I be the one to register it? I also want to be a contributor.)
// The results will vary depending on whether you use @EnableFeignClients("org.project") or just @EnableFeignClients.
@Test
void isThereBeanImplementedMultiModule() {
String feignBeanName = "alarmCommonFeignClient";
String[] beanNames = applicationContext.getBeanDefinitionNames();
for (String beanName : beanNames) {
boolean contains = beanName.contains(feignBeanName);
if (contains) {
assertThat(contains).isEqualTo(true);
}
}
}# console
beanName: alarmCommonFeignClient.FeignClientSpecification