spring-cloud / spring-cloud/spring-cloud-commons

AOT NamedContextFactory registerBeans(GenericApplicationContext must be an instance of interface AnnotationConfigRegistry)

Open
#1,518 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
751
Forks
744
Avg merge
1d 14h
Merged PRs (30d)
9

Description

Describe the bug
Please provide details of the problem, including the version of Spring Cloud that you
are using.

springboot 3.4.6
springcloud 2024.0.1
spring-cloud-starter-neflix-eureka-client 4.2.1
spring-cloud-balancer 4.2.1
spring-context 6.2.7

here the stack:

ava.lang.IllegalArgumentException: Object of class [org.springframework.context.support.GenericApplicationContext] must be an instance of interface
rg.springframework.context.annotation.AnnotationConfigRegistry
at org.springframework.util.Assert.instanceCheckFailed(Assert.java:618)
at org.springframework.util.Assert.isInstanceOf(Assert.java:513)
at org.springframework.util.Assert.isInstanceOf(Assert.java:546)
at org.springframework.cloud.context.named.NamedContextFactory.registerBeans(NamedContextFactory.java:144)
at org.springframework.cloud.context.named.NamedContextFactory.createContext(NamedContextFactory.java:138)
at org.springframework.cloud.context.named.NamedContextFactory.getContext(NamedContextFactory.java:123)
at org.springframework.cloud.context.named.NamedContextFactory.getInstances(NamedContextFactory.java:254)
at org.springframework.cloud.loadbalancer.blocking.client.BlockingLoadBalancerClient.getSupportedLifecycleProcessors(BlockingLoadBalancerClie
t.java:143)
at org.springframework.cloud.loadbalancer.blocking.client.BlockingLoadBalancerClient.execute(BlockingLoadBalancerClient.java:72)
at org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor.intercept(LoadBalancerInterceptor.java:55)
at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:88)
at com.spdb.communication.interceptor.RequestHeaderInterceptor.intercept(RequestHeaderInterceptor.java:28)
at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:88)
at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:72)
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:81)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:900)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:801)
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:549)

Sample
If possible, please provide a test case or sample application that reproduces
the problem. This makes it much easier for us to diagnose the problem and to verify that
we have fixed it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading NamedContextFactory.registerBeans, createContext, and getContext, which appear in the stack trace, using the listed Spring Boot, Spring Cloud, and Spring Framework versions. Reproduce the failure with the reported Eureka and load-balancer setup; done means the context can be created without the reported AnnotationConfigRegistry exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.