spring-projects / spring-projects/spring-modulith
OpenFeign in another module
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 222
- PR merge metrics
- No merged PRs in 30d
Description
id("org.springframework.boot") version "3.5.7"
id("io.spring.dependency-management") version "1.1.7"
extra["springCloudVersion"] = "2025.0.0"
extra["springModulithVersion"] = "1.4.3"
When a project has an OpenFeign in it (implementation("org.springframework.cloud:spring-cloud-starter-openfeign")) and a feign client is in some module, other than a testing one, then when one does a module test (@ApplicationModuleTest), then the test fails with an exception:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.openfeign.aot.FeignClientBeanFactoryInitializationAotProcessor]: Factory method 'feignClientBeanFactoryInitializationCodeGenerator' threw exception with message: No bean named 'some.package.SmsCenter' available
at app//org.springframework.beans.factory.support.SimpleInstantiationStrategy.lambda$instantiate$0(SimpleInstantiationStrategy.java:200)
at app//org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiateWithFactoryMethod(SimpleInstantiationStrategy.java:89)
at app//org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:169)
at app//org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 31 more
But if it (the module, containing the feign interface) is added to the test scope (@ApplicationModuleTest(extraIncludes = ["sms"])), then the test passes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with Spring Boot 3.5.7, Spring Cloud 2025.0.0, OpenFeign, and an @ApplicationModuleTest whose Feign client is in another module. Compare the failing test with @ApplicationModuleTest(extraIncludes = ["sms"]); done means the module test passes without requiring the Feign module to be added explicitly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100