Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nacos-aot-sample运行失败 Injection of @NacosInjected dependencies is failed #349

Open
robin977 opened this issue Feb 15, 2025 · 0 comments

Comments

@robin977
Copy link

Injection of @NacosInjected dependencies is failed
Image

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aotController': Injection of @NacosInjected dependencies is failed
at com.alibaba.nacos.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessProperties(AbstractAnnotationBeanPostProcessor.java:182) ~[nacos-aot-sample:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1416) ~[nacos-aot-sample:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597) ~[nacos-aot-sample:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[nacos-aot-sample:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[nacos-aot-sample:6.0.8]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[nacos-aot-sample:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[nacos-aot-sample:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[nacos-aot-sample:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[nacos-aot-sample:6.0.8]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917) ~[nacos-aot-sample:6.0.8]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[nacos-aot-sample:6.0.8]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[nacos-aot-sample:3.0.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[nacos-aot-sample:3.0.6]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[nacos-aot-sample:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[nacos-aot-sample:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[nacos-aot-sample:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[nacos-aot-sample:3.0.6]
at com.alibaba.boot.nacos.sample.AotApplication.main(AotApplication.java:30) ~[nacos-aot-sample:na]
Caused by: java.lang.UnsupportedOperationException: Only support to inject types[[interface com.alibaba.nacos.api.config.ConfigService]] instance , however actual injected type [interface com.alibaba.nacos.api.naming.NamingService] in member[private com.alibaba.nacos.api.naming.NamingService com.alibaba.boot.nacos.sample.controller.AotController.namingService]
at com.alibaba.nacos.spring.beans.factory.annotation.AnnotationNacosInjectedBeanPostProcessor.buildInjectedObjectCacheKey(AnnotationNacosInjectedBeanPostProcessor.java:128) ~[nacos-aot-sample:na]
at com.alibaba.nacos.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.getInjectedObject(AbstractAnnotationBeanPostProcessor.java:403) ~[nacos-aot-sample:na]
at com.alibaba.nacos.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor$AnnotatedFieldElement.inject(AbstractAnnotationBeanPostProcessor.java:625) ~[nacos-aot-sample:na]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:133) ~[nacos-aot-sample:6.0.8]
at com.alibaba.nacos.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessProperties(AbstractAnnotationBeanPostProcessor.java:178) ~[nacos-aot-sample:na]
... 17 common frames omitted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant