`

No bean named 'xxxxxxx' is defined

阅读更多

Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'asyncResAndBizTaskService' is defined

at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:529)

at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:277)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)

at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1093)

at com.iflytek.musicsearch.asynctool.spi.AsyncResAndBizTask.init(AsyncResAndBizTask.java:38)

at com.iflytek.musicsearch.toolsframework.policy.AbstractRunPolicy.init(AbstractRunPolicy.java:23)

at com.iflytek.musicsearch.toolsframework.policy.TimerPolicy.init(TimerPolicy.java:31)

at com.iflytek.musicsearch.toolsframework.config.Context.<init>(Context.java:46)

at com.iflytek.musicsearch.toolsframework.main.Main.initCinfig(Main.java:89)

 

刚开始一直以为是bean的名称和xml配置的问题(比如bean名称错误,xml未设置自动扫描等等),

后来才发现是因为 @Service引用的包不对,因为引用的lib包中有两个包内均有@Service注解

改成 import org.springframework.stereotype.Service; 就好了

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics