大家好,我申請工作正常,但在延長我的經理和DAO接口,我得到的錯誤。我試圖解決方案(改變<context:component-scan base-package="com.controller" />
到<context:component-scan base-package="com" />
)張貼在各崗位但給我stackOverflowError
。我認爲擴展接口時需要一些註釋,但我不知道應該在那裏使用哪些註釋。請指引我上無法延長DAO和Manager界面自動裝配領域
//控制器
@Controller
public class Controller {
@Autowired
private Manager2<Entity> manager;
//管理接口並實現了一套
public interface Manager1 <T> {
public void add(T entity);
public List<T> getAll();
public T getById(Integer id);
public void delete(Integer id);
public void update(T entity);
}
public interface Manager2<T> extends Manager1<T> {
public List<Entity> getList(int Id);
}
@Service
public class ManagerImpl implements Manager2<Entity> {
@Autowired
private Manager2<Entity> dao;
}
// DAO接口並實現了一套
// servlet.xml文件中的聲明
<context:component-scan base-package="com.controller" />
<bean id="dao" class="com.dao.DaoImpl"></bean>
<bean id="manager" class="com.service.ManagerImpl"></bean>
//從日誌文件中的錯誤
nested exception is `org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.service.Manager2] 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)}`
感謝的人它的作品! – Ishan