0
的依賴發現我有一個罐子Spring MVC的:沒有類型的排位豆使用@Component
package com.tdk.iot;
@Component
public class LogTemplate {
..
}
這個類,這是我的應用程序上下文文件:
<context:component-scan base-package="com.tdk.iot" />
但是,當我開始應用我有這樣的錯誤:
weblogic.application.ModuleException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.tdk.iot.LogTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
我不會推薦混合註釋和XML。 – mre
如果您的LogTemplate類自動連接其他類,並且它不在「com.tdk.iot」包中,那麼您需要將這些包掃描添加到您的xml組件中 - scan – Nimesh
您能完整顯示LogTemplate ...或至少要等到課堂級別變量的聲明 –